diff options
Diffstat (limited to 'src/libudev/util.c')
-rw-r--r-- | src/libudev/util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libudev/util.c b/src/libudev/util.c index af7477ba6f..116d723a0f 100644 --- a/src/libudev/util.c +++ b/src/libudev/util.c @@ -658,6 +658,17 @@ int null_or_empty_path(const char *fn) { return null_or_empty(&st); } +int null_or_empty_fd(int fd) { + struct stat st; + + assert(fd >= 0); + + if (fstat(fd, &st) < 0) + return -errno; + + return null_or_empty(&st); +} + bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) { assert(de); |