initctl: touch does not support template services

Fixes #403

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2024-04-03 07:47:23 +02:00
1 parent 052136cb99
commit 7b501f255b
2 files changed
+30

No files matched your search

+20
View File
@@ -109,6 +109,26 @@ static inline int paste(char *buf, size_t len, const char *dir, const char *file
fisslashdir(dir) ? "" : file[0] == '/' ? "" : "/", file);
}
/* ensure path has suffix */
static inline int suffix(char *path, size_t len, const char *sfx)
{
size_t slen = strlen(sfx);
size_t plen = strlen(path);
if (plen < slen)
slen = strlcat(path, sfx, len);
else {
plen -= slen;
if (strcmp(&path[plen], sfx))
slen = strlcat(path, sfx, len);
}
if (slen >= len)
return -1;
return 0;
}
#endif /* FINIT_UTIL_H_ */
/**