summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-10-26 11:26:35 -0400
committerAnthony G. Basile <blueness@gentoo.org>2014-10-26 11:26:35 -0400
commitabf869c4168fedffd0f992d2f215a924258c294b (patch)
treec5b24b4c9847dfd24dd7218a2a5f8295fc75253b /src/shared
parent5f5839857c805ec9960ecba7d9742fe90d2f5b4b (diff)
label: move is_dir() to util.c
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/mkdir.c14
-rw-r--r--src/shared/util.c14
-rw-r--r--src/shared/util.h2
3 files changed, 16 insertions, 14 deletions
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index e1e7f82a12..0c2a6cfe4d 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -30,20 +30,6 @@
#include "path-util.h"
#include "mkdir.h"
-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 mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mkdir_func_t _mkdir) {
const char *p, *e;
int r;
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;
diff --git a/src/shared/util.h b/src/shared/util.h
index 805cf29920..9550aa19f9 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -412,4 +412,6 @@ union file_handle_union {
char *tempfn_xxxxxx(const char *p);
+int is_dir(const char *path, bool follow);
+
int execute_command(const char *command, char *const argv[]);