Skip to content

Commit

Permalink
Merge pull request #217 from giuseppe/add-error-checks
Browse files Browse the repository at this point in the history
main: fix lookup for overflow uid
  • Loading branch information
giuseppe authored Jun 20, 2020
2 parents b420338 + 94ee6dc commit a7dd943
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* fuse-overlayfs-1.1.1

- fix lookup for overflow uid when it is different than the overflow gid.

* fuse-overlayfs-1.1.0

- use openat2(2) when available.
Expand Down
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ find_mapping (unsigned int id, struct ovl_mapping *mapping, bool direct, bool ui
static uid_t
get_uid (struct ovl_data *data, uid_t id)
{
return find_mapping (id, data->uid_mappings, false, false);
return find_mapping (id, data->uid_mappings, false, true);
}

static uid_t
Expand Down Expand Up @@ -5232,12 +5232,16 @@ main (int argc, char *argv[])
mkdir (path, 0700);
free (lo.workdir);
lo.workdir = strdup (path);
if (lo.workdir == NULL)
error (EXIT_FAILURE, errno, "allocating workdir path");

lo.workdir_fd = open (lo.workdir, O_DIRECTORY);
if (lo.workdir_fd < 0)
error (EXIT_FAILURE, errno, "cannot open workdir");

dfd = dup (lo.workdir_fd);
if (dfd < 0)
error (EXIT_FAILURE, errno, "dup workdir file descriptor");
empty_dirfd (dfd);
}

Expand Down

0 comments on commit a7dd943

Please sign in to comment.