mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Use the same default umask for /dev dirs (DM_DEV_DIR_UMASK).
This commit is contained in:
parent
6c7bde0bba
commit
96e46b8edb
@ -29,6 +29,7 @@
|
|||||||
static int _mk_dir(const char *dev_dir, const char *vg_name)
|
static int _mk_dir(const char *dev_dir, const char *vg_name)
|
||||||
{
|
{
|
||||||
char vg_path[PATH_MAX];
|
char vg_path[PATH_MAX];
|
||||||
|
mode_t old_umask;
|
||||||
|
|
||||||
if (dm_snprintf(vg_path, sizeof(vg_path), "%s%s",
|
if (dm_snprintf(vg_path, sizeof(vg_path), "%s%s",
|
||||||
dev_dir, vg_name) == -1) {
|
dev_dir, vg_name) == -1) {
|
||||||
@ -41,10 +42,14 @@ static int _mk_dir(const char *dev_dir, const char *vg_name)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
log_very_verbose("Creating directory %s", vg_path);
|
log_very_verbose("Creating directory %s", vg_path);
|
||||||
|
|
||||||
|
old_umask = umask(DM_DEV_DIR_UMASK);
|
||||||
if (mkdir(vg_path, 0777)) {
|
if (mkdir(vg_path, 0777)) {
|
||||||
log_sys_error("mkdir", vg_path);
|
log_sys_error("mkdir", vg_path);
|
||||||
|
umask(old_umask);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
umask(old_umask);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
|
|||||||
if (!major)
|
if (!major)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
old_umask = umask(0022);
|
old_umask = umask(DM_DEV_DIR_UMASK);
|
||||||
ret = dm_create_dir(dm_dir());
|
ret = dm_create_dir(dm_dir());
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
|
|
||||||
|
@ -1026,4 +1026,6 @@ int dm_udev_get_sync_support(void);
|
|||||||
int dm_udev_complete(uint32_t cookie);
|
int dm_udev_complete(uint32_t cookie);
|
||||||
int dm_udev_wait(uint32_t cookie);
|
int dm_udev_wait(uint32_t cookie);
|
||||||
|
|
||||||
|
#define DM_DEV_DIR_UMASK 0022
|
||||||
|
|
||||||
#endif /* LIB_DEVICE_MAPPER_H */
|
#endif /* LIB_DEVICE_MAPPER_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user