fs-util: Reduce transitive includes
This commit is contained in:
committed by
Yu Watanabe
parent
c034915cb6
commit
fda652117e
@@ -12,6 +12,7 @@
|
||||
#include "btrfs.h"
|
||||
#include "chattr-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
@@ -376,6 +377,10 @@ int fd_warn_permissions(const char *path, int fd) {
|
||||
return stat_warn_permissions(path, &st);
|
||||
}
|
||||
|
||||
int access_nofollow(const char *path, mode_t mode) {
|
||||
return RET_NERRNO(faccessat(AT_FDCWD, path, mode, AT_SYMLINK_NOFOLLOW));
|
||||
}
|
||||
|
||||
int touch_fd(int fd, usec_t stamp) {
|
||||
assert(fd >= 0);
|
||||
|
||||
@@ -425,6 +430,10 @@ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
|
||||
return RET_GATHER(ret, touch_fd(fd, stamp));
|
||||
}
|
||||
|
||||
int touch(const char *path) {
|
||||
return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
|
||||
}
|
||||
|
||||
int symlinkat_idempotent(const char *from, int atfd, const char *to, bool make_relative) {
|
||||
_cleanup_free_ char *relpath = NULL;
|
||||
int r;
|
||||
@@ -676,6 +685,16 @@ int unlink_or_warn(const char *filename) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *rmdir_and_free(char *p) {
|
||||
PROTECT_ERRNO;
|
||||
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
(void) rmdir(p);
|
||||
return mfree(p);
|
||||
}
|
||||
|
||||
int access_fd(int fd, int mode) {
|
||||
assert(fd >= 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user