char *ul_path_get_abspath(struct path_cxt *pc, char *buf, size_t bufsz, const char *path, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
-int ul_path_stat(struct path_cxt *pc, struct stat *sb, const char *path);
+int ul_path_stat(struct path_cxt *pc, struct stat *sb, int flags, const char *path);
int ul_path_access(struct path_cxt *pc, int mode, const char *path);
int ul_path_accessf(struct path_cxt *pc, int mode, const char *path, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
return !p ? -errno : ul_path_access(pc, mode, p);
}
-int ul_path_stat(struct path_cxt *pc, struct stat *sb, const char *path)
+int ul_path_stat(struct path_cxt *pc, struct stat *sb, int flags, const char *path)
{
int rc;
if (path) {
if (*path == '/')
path++;
- rc = fstatat(dir, path, sb, 0);
+ rc = fstatat(dir, path, sb, flags);
+
} else
rc = fstat(dir, sb); /* dir itself */
struct stat sb;
int rc;
- if ((rc = ul_path_stat(pc, &sb, NULL)) == 0)
+ if ((rc = ul_path_stat(pc, &sb, 0, NULL)) == 0)
*uid = sb.st_uid;
return rc;
}
root_hash_sig_file = strndup(val, len);
rc = root_hash_sig_file ? 0 : -ENOMEM;
if (rc == 0)
- rc = ul_path_stat(NULL, &hash_sig_st, root_hash_sig_file);
+ rc = ul_path_stat(NULL, &hash_sig_st, 0, root_hash_sig_file);
if (rc == 0)
rc = !S_ISREG(hash_sig_st.st_mode) || !hash_sig_st.st_size ? -EINVAL : 0;
if (rc == 0) {
return NULL;
if (ul_path_set_prefix(pc, lsblk->sysroot) != 0)
goto done;
- if (ul_path_stat(pc, &sb, ld->filename) != 0 || !S_ISREG(sb.st_mode))
+ if (ul_path_stat(pc, &sb, 0, ld->filename) != 0 || !S_ISREG(sb.st_mode))
goto done;
fp = ul_path_fopen(pc, "r", ld->filename);
struct stat sb;
struct file *f;
- if (ul_path_stat(pc, &sb, name) < 0)
+ if (ul_path_stat(pc, &sb, 0, name) < 0)
return NULL;
if (ul_path_readlink(pc, sym, sizeof(sym), name) < 0)
return NULL;