return !!set_get(unix_sockets, (char*) fn);
}
-static int dir_is_mount_point(DIR *d, const char *subdir) {
-
- int mount_id_parent, mount_id;
- int r_p, r;
-
- r_p = name_to_handle_at_loop(dirfd(d), ".", NULL, &mount_id_parent, 0);
- if (r_p < 0)
- r_p = -errno;
-
- r = name_to_handle_at_loop(dirfd(d), subdir, NULL, &mount_id, 0);
- if (r < 0)
- r = -errno;
-
- /* got no handle; make no assumptions, return error */
- if (r_p < 0 && r < 0)
- return r_p;
-
- /* got both handles; if they differ, it is a mount point */
- if (r_p >= 0 && r >= 0)
- return mount_id_parent != mount_id;
-
- /* got only one handle; assume different mount points if one
- * of both queries was not supported by the filesystem */
- if (IN_SET(r_p, -ENOSYS, -EOPNOTSUPP) || IN_SET(r, -ENOSYS, -EOPNOTSUPP))
- return true;
-
- /* return error */
- if (r_p < 0)
- return r_p;
- return r;
-}
-
static DIR* xopendirat_nomod(int dirfd, const char *path) {
DIR *dir;
/* Try to detect bind mounts of the same filesystem instance; they
* do not differ in device major/minors. This type of query is not
* supported on all kernels or filesystem types though. */
- if (S_ISDIR(s.st_mode) && dir_is_mount_point(d, dent->d_name) > 0) {
- log_debug("Ignoring \"%s/%s\": different mount of the same filesystem.",
- p, dent->d_name);
- continue;
+ if (S_ISDIR(s.st_mode)) {
+ int q;
+
+ q = fd_is_mount_point(dirfd(d), dent->d_name, 0);
+ if (q < 0)
+ log_debug_errno(q, "Failed to determine whether \"%s/%s\" is a mount point, ignoring: %m", p, dent->d_name);
+ else if (q > 0) {
+ log_debug("Ignoring \"%s/%s\": different mount of the same filesystem.", p, dent->d_name);
+ continue;
+ }
}
- sub_path = strjoin(p, "/", dent->d_name);
+ sub_path = path_join(p, dent->d_name);
if (!sub_path) {
r = log_oom();
goto finish;
continue;
}
- if (mountpoint && S_ISREG(s.st_mode))
- if (s.st_uid == 0 && STR_IN_SET(dent->d_name,
- ".journal",
- "aquota.user",
- "aquota.group")) {
- log_debug("Skipping \"%s\".", sub_path);
- continue;
- }
+ if (mountpoint &&
+ S_ISREG(s.st_mode) &&
+ s.st_uid == 0 &&
+ STR_IN_SET(dent->d_name,
+ ".journal",
+ "aquota.user",
+ "aquota.group")) {
+ log_debug("Skipping \"%s\".", sub_path);
+ continue;
+ }
/* Ignore sockets that are listed in /proc/net/unix */
if (S_ISSOCK(s.st_mode) && unix_socket_alive(sub_path)) {
for (;;) {
_cleanup_free_ char *name = NULL, *value = NULL, *xattr = NULL;
- r = extract_first_word(&p, &xattr, NULL, EXTRACT_QUOTES|EXTRACT_CUNESCAPE);
+ r = extract_first_word(&p, &xattr, NULL, EXTRACT_UNQUOTE|EXTRACT_CUNESCAPE);
if (r < 0)
log_warning_errno(r, "Failed to parse extended attribute '%s', ignoring: %m", p);
if (r <= 0)
if (isempty(k)) /* Don't complain about other paths than /var/run, and not about /var/run itself either. */
return 0;
- n = strjoin("/run/", k);
+ n = path_join("/run", k);
if (!n)
return log_oom();
/* Also log about this briefly. We do so at LOG_NOTICE level, as we fixed up the situation automatically, hence
* there's no immediate need for action by the user. However, in the interest of making things less confusing
* to the user, let's still inform the user that these snippets should really be updated. */
-
- log_notice("[%s:%u] Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.", fname, line, *path, n);
+ log_syntax(NULL, LOG_NOTICE, fname, line, 0, "Line references path below legacy directory /var/run/, updating %s → %s; please update the tmpfiles.d/ drop-in file accordingly.", *path, n);
free_and_replace(*path, n);
r = extract_many_words(
&buffer,
NULL,
- EXTRACT_QUOTES,
+ EXTRACT_UNQUOTE,
&action,
&path,
&mode,
if (arg_root) {
char *p;
- p = prefix_root(arg_root, i.path);
+ p = path_join(arg_root, i.path);
if (!p)
return log_oom();
free_and_replace(i.path, p);