diff options
author | Karel Zak | 2009-09-25 14:40:23 +0200 |
---|---|---|
committer | Karel Zak | 2009-09-25 14:57:17 +0200 |
commit | f38fd19d2b0367f5f4517ba30a8964802c7ce1ab (patch) | |
tree | a0c3e7083307ef5ef708d6e1f234e4691058ca4b /shlibs/blkid/src/blkidP.h | |
parent | libblkid: cleanup blkid_probe_set_device() (diff) | |
download | kernel-qcow2-util-linux-f38fd19d2b0367f5f4517ba30a8964802c7ce1ab.tar.gz kernel-qcow2-util-linux-f38fd19d2b0367f5f4517ba30a8964802c7ce1ab.tar.xz kernel-qcow2-util-linux-f38fd19d2b0367f5f4517ba30a8964802c7ce1ab.zip |
libblkid: use fstatat(), improve readdir() usage
* fix possible memory leak in ubi_probe_all()
* use dirent->d_type if available (this is tricky, because d_type
is not supported on all systems and some filesystems returns
DT_UNKNOWN). The dirent->d_type allows to avoid unnecessary stat()
calls.
* use fstatat() if available -- allows to avoid malloc() and
sprintf("%s/%s", dirname, dirent->d_name)
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/blkidP.h')
-rw-r--r-- | shlibs/blkid/src/blkidP.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/shlibs/blkid/src/blkidP.h b/shlibs/blkid/src/blkidP.h index 68116c0ca..d09529ef6 100644 --- a/shlibs/blkid/src/blkidP.h +++ b/shlibs/blkid/src/blkidP.h @@ -17,6 +17,8 @@ #define CONFIG_BLKID_DEBUG 1 #include <sys/types.h> +#include <dirent.h> +#include <sys/stat.h> #include <stdio.h> #include <stdarg.h> @@ -279,6 +281,9 @@ struct blkid_struct_cache extern char *blkid_strdup(const char *s); extern char *blkid_strndup(const char *s, const int length); +extern char *blkid_strconcat(const char *a, const char *b, const char *c); +extern int blkid_fstatat(DIR *dir, const char *dirname, const char *filename, + struct stat *st, int nofollow); #define BLKID_CACHE_FILE "/etc/blkid.tab" #define BLKID_CONFIG_FILE "/etc/blkid.conf" |