summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 8c64174401..3cad297873 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1373,6 +1373,20 @@ char *tempfn_xxxxxx(const char *p) {
return t;
}
+int is_dir(const char* path, bool follow) {
+ struct stat st;
+
+ if (follow) {
+ if (stat(path, &st) < 0)
+ return -errno;
+ } else {
+ if (lstat(path, &st) < 0)
+ return -errno;
+ }
+
+ return !!S_ISDIR(st.st_mode);
+}
+
int execute_command(const char *command, char *const argv[]) {
pid_t pid;