Relocate ln() helper function

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2023-02-28 00:48:25 +01:00
1 parent e03bd093b5
commit 6942e38413
2 files changed
+15 -6

No files matched your search

+15
View File
@@ -125,6 +125,21 @@ static inline int create(char *path, mode_t mode, char *user, char *group)
return 0;
}
static inline int ln(const char *target, const char *linkpath)
{
if (!target || !linkpath) {
errno = EINVAL;
return -1;
}
if (symlink(target, linkpath)) {
if (errno != EEXIST)
warn("Failed creating %s -> %s symlink", target, linkpath);
return -1;
}
return 0;
}
static inline int dprint(int fd, const char *s, size_t len)
{
size_t loop = 3;