summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-09-16 21:54:15 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-09-16 21:54:15 +0000
commit7b2faca5b09131f1559a65a3487cee16fe3393c6 (patch)
tree46ff787d52438e76972a6b4270af394199aade4b /src
parent930c7fbcc1c236328d0875f857c9ae03d5ad03ec (diff)
downloads6-rc-7b2faca5b09131f1559a65a3487cee16fe3393c6.tar.xz
s6-rc-update bigfux
Diffstat (limited to 'src')
-rw-r--r--src/libs6rc/s6rc_servicedir_manage.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/libs6rc/s6rc_servicedir_manage.c b/src/libs6rc/s6rc_servicedir_manage.c
index e06d7a4..a6775f1 100644
--- a/src/libs6rc/s6rc_servicedir_manage.c
+++ b/src/libs6rc/s6rc_servicedir_manage.c
@@ -39,28 +39,30 @@ int s6rc_servicedir_manage (char const *live, tain_t const *deadline, tain_t *st
if (d->d_name[0] == '.') continue ;
{
unsigned int len = str_len(d->d_name) ;
+ int r ;
uint16 id ;
char srcfn[livelen + 20 + len] ;
char dstfn[livelen + 10 + len] ;
- register int r ;
byte_copy(srcfn, livelen + 12, dirfn) ;
srcfn[livelen + 12] = '/' ;
byte_copy(srcfn + livelen + 13, len + 1, d->d_name) ;
r = s6_svc_ok(srcfn) ;
if (r < 0) { e = errno ; goto err ; }
- if (r) continue ;
- byte_copy(srcfn + livelen + 13 + len, 6, "/down") ;
- if (!touch(srcfn)) { e = errno ; goto err ; }
- byte_copy(srcfn + livelen + 14 + len, 6, "event") ;
- if (!ftrigw_fifodir_make(srcfn, gid, 0)) { e = errno ; goto err ; }
- id = ftrigr_subscribe(&a, srcfn, "s", 0, deadline, stamp) ;
- if (!id) { e = errno ; goto err ; }
- if (!genalloc_append(uint16, &ids, &id)) { e = errno ; goto err ; }
- srcfn[livelen + 13 + len] = 0 ;
+ if (!r)
+ {
+ byte_copy(srcfn + livelen + 13 + len, 6, "/down") ;
+ if (!touch(srcfn)) { e = errno ; goto err ; }
+ byte_copy(srcfn + livelen + 14 + len, 6, "event") ;
+ if (!ftrigw_fifodir_make(srcfn, gid, 0)) { e = errno ; goto err ; }
+ id = ftrigr_subscribe(&a, srcfn, "s", 0, deadline, stamp) ;
+ if (!id) { e = errno ; goto err ; }
+ if (!genalloc_append(uint16, &ids, &id)) { e = errno ; goto err ; }
+ srcfn[livelen + 13 + len] = 0 ;
+ }
byte_copy(dstfn, livelen, live) ;
byte_copy(dstfn + livelen, 9, "/scandir/") ;
byte_copy(dstfn + livelen + 9, len + 1, d->d_name) ;
- if (symlink(srcfn, dstfn) < 0) { e = errno ; goto err ; }
+ if (symlink(srcfn, dstfn) < 0 && (!r || errno != EEXIST)) { e = errno ; goto err ; }
}
}
if (errno) { e = errno ; goto err ; }