return fail;
}
+/* return non-zero if path is absolute or zero if relative. */
+
+int
+isAbsolute(const char *path)
+{
+#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+ return path[1] == ':' || *path == '/' || *path == '\\'; /* drivespec:/blah is absolute */
+#else
+ return *path == '/';
+#endif
+}
+
/* Ensure that the directory ARGPATH exists.
Remove any trailing slashes from ARGPATH before calling this function.
re_protect = 0;
}
+#if defined(HAVE_CYGWIN)
+ /* Because of silly Win32 security, we allow everything */
+ tmp_mode = S_IRWXUGO;
+ re_protect = 0;
+#endif
+
/* If we can record the current working directory, we may be able
to do the chdir optimization. */
cwd.do_chdir = !save_cwd(&cwd);
/* If we've saved the cwd and DIRPATH is an absolute pathname,
we must chdir to `/' in order to enable the chdir optimization.
So if chdir ("/") fails, turn off the optimization. */
- if (cwd.do_chdir && *dirpath == '/' && chdir ("/") < 0) {
+ if (cwd.do_chdir && isAbsolute(dirpath) && (chdir("/") < 0)) {
cwd.do_chdir = 0;
}
#endif
)
{
- Jmsg(jcr, M_ERROR, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
}
Dmsg1(300, "Final chmod mode=%o\n", mode);
}
if ((mode & ~S_IRWXUGO) && chmod(basename_dir, mode)) {
- Jmsg(jcr, M_ERROR, 0, _("Cannot change permissions of %s: ERR=%s\n"),
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
*(p->dirname_end) = '\0';
Dmsg2(300, "Reset parent mode=%o dir=%s\n", parent_mode, dirpath);
if (chmod(dirpath, parent_mode)) {
- Jmsg(jcr, M_ERROR, 0, _("Cannot change permissions of %s: ERR=%s\n"),
- quote (dirpath), strerror(errno));
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
+ quote(dirpath), strerror(errno));
}
}
} else {
&& errno != EPERM
#endif
) {
- Jmsg(jcr, M_ERROR, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change owner and/or group of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
if (chmod(dirpath, mode)) {
- Jmsg(jcr, M_ERROR, 0, _("Cannot change permissions of %s: ERR=%s\n"),
+ Jmsg(jcr, M_WARNING, 0, _("Cannot change permissions of %s: ERR=%s\n"),
quote(dirpath), strerror(errno));
}
Dmsg2(300, "pathexists chmod mode=%o dir=%s\n", mode, dirpath);