Merge pull request #26949 from DaanDeMeyer/xopenat-reopen
loop-util: Add loop_device_make_by_path_at()
This commit is contained in:
@@ -1104,6 +1104,11 @@ int xopenat(int dir_fd, const char *path, int flags, mode_t mode) {
|
||||
assert(dir_fd >= 0 || dir_fd == AT_FDCWD);
|
||||
assert(path);
|
||||
|
||||
if (isempty(path)) {
|
||||
assert(!FLAGS_SET(flags, O_CREAT|O_EXCL));
|
||||
return fd_reopen(dir_fd, flags);
|
||||
}
|
||||
|
||||
if (FLAGS_SET(flags, O_DIRECTORY|O_CREAT)) {
|
||||
r = RET_NERRNO(mkdirat(dir_fd, path, mode));
|
||||
if (r == -EEXIST) {
|
||||
|
||||
Reference in New Issue
Block a user