]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: make touch() an inline function
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Aug 2022 07:45:04 +0000 (09:45 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Aug 2022 12:58:33 +0000 (21:58 +0900)
src/basic/fs-util.c
src/basic/fs-util.h

index cc25222c32df14403ea2657ea71bc52cde6d0e23..d1272fb04b1c12a9824aaad077de2f9c203c3a51 100644 (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;
index e48cf6800fac1796ba7d403a592adb2c1fe4d603..080959d3b99b9e221803276ba49bf0cea9518bcb 100644 (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);