summaryrefslogtreecommitdiff
path: root/src/basic/util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-19 23:58:17 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-22 01:59:24 +0200
commitac7edd91670ae859cda6e9b2b97fd87f2639433a (patch)
treedb1b1975f91c893cf7a2801c11279f291755071f /src/basic/util.h
parent2dcc3c69a10f76e0ee9185c863d23ee62d481919 (diff)
util: improve dir_is_empty() call
Simplify the call, and add dir_is_populated() as inverse call, in order to make some checks easier to read.
Diffstat (limited to 'src/basic/util.h')
-rw-r--r--src/basic/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/util.h b/src/basic/util.h
index ff39eae715..a3ebb987e4 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -358,6 +358,14 @@ bool is_device_path(const char *path);
int dir_is_empty(const char *path);
char* dirname_malloc(const char *path);
+static inline int dir_is_populated(const char *path) {
+ int r;
+ r = dir_is_empty(path);
+ if (r < 0)
+ return r;
+ return !r;
+}
+
char* lookup_uid(uid_t uid);
char* getlogname_malloc(void);
char* getusername_malloc(void);