In order to distinguish it from libc function naming.
* - we can modify the hierarchy. */
cpath = strjoina("/sys/fs/cgroup/", dn, root, root ? "/cgroup.procs" : NULL);
- return laccess(cpath, root ? W_OK : F_OK);
+ return access_nofollow(cpath, root ? W_OK : F_OK);
}
int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **ret) {
int fd_warn_permissions(const char *path, int fd);
int stat_warn_permissions(const char *path, const struct stat *st);
-#define laccess(path, mode) \
+#define access_nofollow(path, mode) \
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);
/* Does the path exist at all? If not, generate an error immediately. This is useful so that a missing root dir
* always results in -ENOENT, and we can properly distinguish the case where the whole root doesn't exist from
* the case where just the os-release file is missing. */
- r = laccess(path, F_OK);
+ r = access_nofollow(path, F_OK);
if (r < 0)
return r;
if (!joined)
return -ENOMEM;
- r = laccess(joined, F_OK);
+ r = access_nofollow(joined, F_OK);
if (r >= 0) {
*ret_path = TAKE_PTR(joined);
return 0;
assert_cc(EXEC_DIRECTORY_STATE < EXEC_DIRECTORY_LOGS);
assert_cc(EXEC_DIRECTORY_LOGS < EXEC_DIRECTORY_CONFIGURATION);
- r = laccess(p, F_OK);
+ r = access_nofollow(p, F_OK);
if (r == -ENOENT) {
_cleanup_free_ char *q = NULL;
goto fail;
}
- r = laccess(q, F_OK);
+ r = access_nofollow(q, F_OK);
if (r >= 0) {
/* It does exist! This hence looks like an update. Symlink the
* configuration directory into the state directory. */
goto fail;
if (is_dir(p, false) > 0 &&
- (laccess(pp, F_OK) == -ENOENT)) {
+ (access_nofollow(pp, F_OK) == -ENOENT)) {
/* Hmm, the private directory doesn't exist yet, but the normal one exists? If so, move
* it over. Most likely the service has been upgraded from one that didn't use
pair[0] = safe_close(pair[0]);
- r = laccess("/run/systemd/coredump", W_OK);
+ r = access_nofollow("/run/systemd/coredump", W_OK);
if (r < 0) {
log_debug_errno(r, "Cannot find coredump socket, exiting: %m");
_exit(EXIT_FAILURE);
_cleanup_free_ char *dn = NULL;
usec_t w;
- r = laccess(path, F_OK);
+ r = access_nofollow(path, F_OK);
if (r >= 0)
return 0; /* Found it */
if (r != -ENOENT)
if (!vmlinuz)
return log_oom();
- r = laccess(vmlinuz, F_OK);
+ r = access_nofollow(vmlinuz, F_OK);
if (r == -ENOENT)
return log_error_errno(r, "Kernel image not installed to '%s', requiring manual kernel image path specification.", vmlinuz);
if (r < 0)
/* We test whether the runtime unit file directory has been created. This takes place in mount-setup.c,
* so is guaranteed to happen very early during boot. */
- r = laccess("/run/systemd/system/", F_OK);
+ r = access_nofollow("/run/systemd/system/", F_OK);
if (r >= 0)
return true;
if (r == -ENOENT)
goto finish;
}
- if (laccess(p, F_OK) < 0) {
+ if (access_nofollow(p, F_OK) < 0) {
r = log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Directory %s doesn't look like it has an OS tree (/usr/ directory is missing). Refusing.", arg_directory);
goto finish;
if (image_name_is_valid(image)) {
char *c;
- if (!arg_quiet && laccess(image, F_OK) >= 0)
+ if (!arg_quiet && access_nofollow(image, F_OK) >= 0)
log_warning("Ambiguous invocation: current working directory contains file matching non-path argument '%s', ignoring. "
"Prefix argument with './' to force reference to file in current working directory.", image);
if (!j)
return -ENOMEM;
- r = laccess(j, F_OK);
+ r = access_nofollow(j, F_OK);
if (r >= 0)
return true; /* yay! */
if (r != -ENOENT)
_cleanup_strv_free_ char **g = NULL;
const char* dir;
- if (laccess("/run/log/journal", F_OK) >= 0)
+ if (access_nofollow("/run/log/journal", F_OK) >= 0)
dir = "/run/log/journal";
else
dir = "/var/log/journal";
fs = mnt_table_find_target(table, path, MNT_ITER_FORWARD);
if (!fs) {
- r = laccess(path, F_OK); /* Hmm, it's not in the mount table, but does it exist at all? */
+ r = access_nofollow(path, F_OK); /* Hmm, it's not in the mount table, but does it exist at all? */
if (r < 0)
return r;
assert(!options || (flags & MOUNT_IN_NAMESPACE_IS_IMAGE));
p = strjoina(propagate_path, "/");
- r = laccess(p, F_OK);
+ r = access_nofollow(p, F_OK);
if (r < 0)
return log_debug_errno(r == -ENOENT ? SYNTHETIC_ERRNO(EOPNOTSUPP) : r, "Target does not allow propagation of mount points");
if (!p)
return log_oom();
- r = laccess(p, F_OK);
+ r = access_nofollow(p, F_OK);
if (r == -ENOENT) /* Hierarchy apparently was empty in all extensions, and wasn't mounted, ignoring. */
continue;
if (r < 0)
int r;
FOREACH_STRING(p, "/system-update", "/etc/system-update") {
- r = laccess(p, F_OK);
+ r = access_nofollow(p, F_OK);
if (r < 0) {
if (r != -ENOENT)
log_warning_errno(r, "Failed to check if %s symlink exists, ignoring: %m", p);
path_simplify(i.argument);
- if (laccess(i.argument, F_OK) == -ENOENT) {
+ if (access_nofollow(i.argument, F_OK) == -ENOENT) {
/* Silently skip over lines where the source file is missing. */
log_syntax(NULL, LOG_DEBUG, fname, line, 0,
"Copy source path '%s' does not exist, skipping line.", i.argument);
assert(path);
if (arg_wait_until == WAIT_UNTIL_REMOVED) {
- r = laccess(path, F_OK);
+ r = access_nofollow(path, F_OK);
if (r == -ENOENT)
return true;
if (r < 0)