summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_servicedir_copy_offline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6rc/s6rc_servicedir_copy_offline.c')
-rw-r--r--src/libs6rc/s6rc_servicedir_copy_offline.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs6rc/s6rc_servicedir_copy_offline.c b/src/libs6rc/s6rc_servicedir_copy_offline.c
index 6581a4f..b517536 100644
--- a/src/libs6rc/s6rc_servicedir_copy_offline.c
+++ b/src/libs6rc/s6rc_servicedir_copy_offline.c
@@ -2,16 +2,17 @@
#include <sys/stat.h>
#include <errno.h>
+
#include "s6rc-servicedir-internal.h"
#include <s6-rc/s6rc-servicedir.h>
int s6rc_servicedir_copy_offline (char const *src, char const *dst)
{
s6rc_servicedir_desc_t const *p = s6rc_servicedir_file_list ;
- if (mkdir(dst, 0755) < 0)
- {
- if (errno != EEXIST) return 0 ;
- }
+ mode_t m = umask(0) ;
+ int r = mkdir(dst, 0755) ;
+ umask(m) ;
+ if (r < 0 && errno != EEXIST) return 0 ;
for (; p->name ; p++)
if (!s6rc_servicedir_copy_one(src, dst, p)) return 0 ;
return 1 ;