aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-01-23 02:14:20 +0000
committerErik Andersen <andersen@codepoet.org>2000-01-23 02:14:20 +0000
commit06936df16411fff0fdc338cae28385d66cabcef8 (patch)
tree570cf3d9aea702854ebc8cf65d02a6c85cca09fa /utility.c
parentde552874d2074ac48ea4b834d61c54e1b6971be3 (diff)
downloadbusybox-06936df16411fff0fdc338cae28385d66cabcef8.tar.gz
Fix a bug where tar could change perms and ownership of dirs pointed
to by symlink within a tarball. -Erik
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/utility.c b/utility.c
index ade47bde0..4b67ce9b7 100644
--- a/utility.c
+++ b/utility.c
@@ -495,11 +495,12 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir
* while all previous ones get default protections. Errors are not reported
* here, as failures to restore files can be reported later.
*/
-extern void createPath (const char *name, int mode)
+extern int createPath (const char *name, int mode)
{
char *cp;
char *cpOld;
char buf[NAME_MAX];
+ int retVal=0;
strcpy( buf, name);
cp = strchr (buf, '/');
@@ -507,9 +508,17 @@ extern void createPath (const char *name, int mode)
cpOld = cp;
cp = strchr (cp + 1, '/');
*cpOld = '\0';
- mkdir (buf, cp ? 0777 : mode);
+ retVal = mkdir (buf, cp ? 0777 : mode);
*cpOld = '/';
}
+ /* Return the result from the final directory, as that
+ * is the one that counts */
+ if( retVal!=0) {
+ if ( errno!=EEXIST) {
+ return( FALSE);
+ }
+ }
+ return( TRUE);
}
#endif