diff options
author | Alexander Larsson <alexl@redhat.com> | 2018-03-14 15:22:12 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-16 22:07:13 +0000 |
commit | 1e90a18a085e324b821a8bd0dc28a27082e43634 (patch) | |
tree | 563dbd09053d11ca8689dba24bfa61266f32fc3c /utils.h | |
parent | 3c488585bd9897c842c1708ddb413adee5a9b43a (diff) | |
download | bubblewrap-1e90a18a085e324b821a8bd0dc28a27082e43634.tar.gz |
Don't rely on mkdir returning EEXISTS (fixing NFS)
For NFS mounts if we call mkdir() on a read-only mount (such as when
we've created a read-only bind mount) the kernel will nor return EEXIST
even when the directory exists, instead returning EROFS.
So, we add (and use) an ensure_dir() helper that stats before calling
mkdir.
Closes: #258
Approved by: giuseppe
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -101,6 +101,8 @@ int create_file (const char *path, const char *content); int ensure_file (const char *path, mode_t mode); +int ensure_dir (const char *path, + mode_t mode); int get_file_mode (const char *pathname); int mkdir_with_parents (const char *pathname, int mode, |