summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_servicedir_copy_offline.c
blob: 6581a4f0af22f91ddb4215a77743bfe75432f9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* ISC license. */

#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 ;
  }
  for (; p->name ; p++)
    if (!s6rc_servicedir_copy_one(src, dst, p)) return 0 ;
  return 1 ;
}