From 86b4e141a574551ccb442f66725350bab15bfba5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Aug 2022 09:45:04 +0200 Subject: [PATCH] fs-util: make touch() an inline function --- src/basic/fs-util.c | 4 ---- src/basic/fs-util.h | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index cc25222c32d..d1272fb04b1 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -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; diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index e48cf6800fa..080959d3b99 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -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);