- char *p; /* Points into path */
- int madeone = 0; /* Did we do anything yet? */
- int save_errno = errno; /* Remember caller's errno */
- int check;
-
- if (errno != ENOENT)
- return 0; /* Not our problem */
-
- for (p = index(pathname, '/'); p != NULL; p = index(p+1, '/')) {
- /* Avoid mkdir of empty string, if leading or double '/' */
- if (p == pathname || p[-1] == '/')
- continue;
- /* Avoid mkdir where last part of path is '.' */
- if (p[-1] == '.' && (p == pathname+1 || p[-2] == '/'))
- continue;
- *p = 0; /* Truncate the path there */
- check = mkdir (pathname, 0777); /* Try to create it as a dir */
- if (check == 0) {
- /* Fix ownership */
- if (we_are_root) {
- if (chown(pathname, hstat.st_uid,
- hstat.st_gid) < 0) {
- msg_perror("cannot change owner of %s to uid %d gid %d",pathname,hstat.st_uid,hstat.st_gid);
- }
- }
- pr_mkdir(pathname, p-pathname, notumask&0777);
- madeone++; /* Remember if we made one */
- *p = '/';
- continue;
+ char *p; /* Points into path */
+ int madeone = 0; /* Did we do anything yet? */
+ int save_errno = errno; /* Remember caller's errno */
+ int check;
+
+ if (errno != ENOENT)
+ return 0; /* Not our problem */
+
+ for (p = index (pathname, '/'); p != NULL; p = index (p + 1, '/'))
+ {
+ /* Avoid mkdir of empty string, if leading or double '/' */
+ if (p == pathname || p[-1] == '/')
+ continue;
+ /* Avoid mkdir where last part of path is '.' */
+ if (p[-1] == '.' && (p == pathname + 1 || p[-2] == '/'))
+ continue;
+ *p = 0; /* Truncate the path there */
+ check = mkdir (pathname, 0777); /* Try to create it as a dir */
+ if (check == 0)
+ {
+ /* Fix ownership */
+ if (we_are_root)
+ {
+ if (chown (pathname, hstat.st_uid,
+ hstat.st_gid) < 0)
+ {
+ msg_perror ("cannot change owner of %s to uid %d gid %d", pathname, hstat.st_uid, hstat.st_gid);