fs-util: make touch() an inline function

This commit is contained in:
Lennart Poettering 2022-08-17 09:45:04 +02:00 committed by Yu Watanabe
parent aba5dac372
commit 86b4e141a5
2 changed files with 5 additions and 5 deletions

View file

@ -398,10 +398,6 @@ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
return ret;
}
int touch(const char *path) {
return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
}
int symlink_idempotent(const char *from, const char *to, bool make_relative) {
_cleanup_free_ char *relpath = NULL;
int r;

View file

@ -13,6 +13,7 @@
#include "alloc-util.h"
#include "errno-util.h"
#include "time-util.h"
#include "user-util.h"
#define MODE_INVALID ((mode_t) -1)
@ -50,7 +51,10 @@ int stat_warn_permissions(const char *path, const struct stat *st);
RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW))
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
int touch(const char *path);
static inline int touch(const char *path) {
return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
}
int symlink_idempotent(const char *from, const char *to, bool make_relative);