diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-01-09 22:24:26 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-01-09 22:24:26 +0000 |
commit | aeb3ad3d8cac8f1f085725711d2d8739b722b61b (patch) | |
tree | 2225c0b37c1a19161383c67bdb9043006e8b4fe0 /src/instance/s6-instance-delete.c | |
parent | 724fc63f4736d620173e733a3b35c003a0d82ff8 (diff) | |
download | s6-aeb3ad3d8cac8f1f085725711d2d8739b722b61b.tar.xz |
Next batch of fixes
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/instance/s6-instance-delete.c')
-rw-r--r-- | src/instance/s6-instance-delete.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/instance/s6-instance-delete.c b/src/instance/s6-instance-delete.c index 37c345c..92078e0 100644 --- a/src/instance/s6-instance-delete.c +++ b/src/instance/s6-instance-delete.c @@ -21,6 +21,7 @@ int main (int argc, char const *const *argv) { tain tto = TAIN_INFINITE_RELATIVE ; + size_t namelen ; uint32_t options = 1 ; PROG = "s6-instance-delete" ; { @@ -42,7 +43,9 @@ int main (int argc, char const *const *argv) } if (argc < 2) dieusage() ; if (!argv[0][0]) strerr_dief1x(100, "invalid service path") ; - if (!argv[1][0] || argv[1][0] == '.' || byte_in(argv[1], strlen(argv[1]), " \t\f\r\n", 5) < strlen(argv[1])) + + namelen = strlen(argv[1]) ; + if (!argv[1][0] || argv[1][0] == '.' || byte_in(argv[1], namelen, " \t\f\r\n", 5) < namelen) strerr_dief1x(100, "invalid instance name") ; tain_now_set_stopwatch_g() ; @@ -50,11 +53,14 @@ int main (int argc, char const *const *argv) { size_t svlen = strlen(argv[0]) ; - char sc[svlen + 10] ; + char sc[svlen + 12 + namelen] ; memcpy(sc, argv[0], svlen) ; memcpy(sc + svlen, "/instance", 10) ; if (s6_supervise_unlink_names_g(sc, argv + 1, 1, options, &tto) == -1) strerr_diefu4sys(111, "prepare deletion of instance ", argv[1], " of service ", argv[0]) ; + memcpy(sc + svlen + 9, "s/", 2) ; + memcpy(sc + svlen + 11, argv[1], namelen + 1) ; + rm_rf(sc) ; } return 0 ; |