if (!cxt->mtab_writable)
/* use /dev/.mount/utab if /etc/mtab is useless */
- mnt_has_regular_mtab(&cxt->utab_path, &cxt->utab_writable);
+ mnt_has_regular_utab(&cxt->utab_path, &cxt->utab_writable);
return cxt;
}
/* Don't try to touch mtab if umounting root FS */
cxt->flags |= MNT_FL_NOMTAB;
- if ((cxt->flags & MNT_FL_NOMTAB) || cxt->helper)
+ if (cxt->flags & MNT_FL_NOMTAB) {
+ DBG(CXT, mnt_debug_h(cxt, "skip update: NOMTAB flag"));
return 0;
- if (!cxt->mtab_writable && !cxt->utab_writable)
+ }
+ if (cxt->helper) {
+ DBG(CXT, mnt_debug_h(cxt, "skip update: external helper"));
return 0;
-
+ }
+ if (!cxt->mtab_writable && !cxt->utab_writable) {
+ DBG(CXT, mnt_debug_h(cxt, "skip update: no writable destination"));
+ return 0;
+ }
if (!cxt->update) {
cxt->update = mnt_new_update(!cxt->mtab_writable);
if (!cxt->update)
{ "--umount", test_umount, "[-t <type>] [-f][-l][-r] <src>|<target>" },
{ NULL }};
+
+ umask(S_IWGRP|S_IWOTH); /* to be compatible with mount(8) */
+
return mnt_run_test(tss, argc, argv);
}
*/
char *p, *p0;
+ DBG(CXT, mnt_debug_h(cxt, "tring mount by FS pattern list"));
+
p0 = p = strdup(pattern);
if (!p)
return -ENOMEM;
/*
* try /etc/filesystems and /proc/filesystems
*/
+ DBG(CXT, mnt_debug_h(cxt, "tring mount by filesystems lists"));
+
rc = mnt_get_filesystems(&filesystems, neg ? pattern : NULL);
if (rc)
return rc;
const char *utab = NULL;
if (mnt_has_regular_mtab(&filename, NULL)) {
+
+ DBG(TAB, mnt_debug_h(tb, "force %s usage", filename));
+
rc = mnt_tab_parse_file(tb, filename);
if (!rc)
return 0;
return mnt_tab_parse_file(tb, _PATH_PROC_MOUNTS);
/*
- * try to read userspace specific information from /dev/.mount/utabs/
+ * try to read userspace specific information from /dev/.mount/utabs
*/
utab = mnt_get_utab_path();
if (utab) {
- mnt_tab *u_tb = mnt_new_tab_from_dir(utab);
+ mnt_tab *u_tb = mnt_new_tab_from_file(utab);
if (u_tb) {
mnt_fs *u_fs;
DBG(UPDATE, mnt_debug("%s: locking", lfile));
- fd = open(lfile, O_RDONLY|O_CREAT|O_CLOEXEC, S_IRUSR|S_IWUSR);
+ fd = open(lfile, O_RDONLY|O_CREAT|O_CLOEXEC, S_IWUSR|
+ S_IRUSR|S_IRGRP|S_IROTH);
free(lfile);
if (fd < 0)
char *mnt_getenv_safe(const char *arg)
{
+ return getenv(arg);
+
if ((getuid() != geteuid()) || (getgid() != getegid()))
return NULL;
#if HAVE_PRCTL
if (!filename)
return -EINVAL;
- fd = open(filename, O_RDWR, 0644);
+ fd = open(filename, O_RDWR|O_CREAT, S_IWUSR| \
+ S_IRUSR|S_IRGRP|S_IROTH);
if (fd >= 0) {
close(fd);
return 0;
stripoff_last_component(dirname); /* remove filename */
- rc = mkdir(dirname, 755);
+ rc = mkdir(dirname, S_IWUSR|
+ S_IRUSR|S_IRGRP|S_IROTH|
+ S_IXUSR|S_IXGRP|S_IXOTH);
free(dirname);
if (rc && errno != EEXIST)
goto done; /* probably EACCES */