diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-01-23 02:14:20 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-01-23 02:14:20 +0000 |
commit | 06936df16411fff0fdc338cae28385d66cabcef8 (patch) | |
tree | 570cf3d9aea702854ebc8cf65d02a6c85cca09fa /utility.c | |
parent | de552874d2074ac48ea4b834d61c54e1b6971be3 (diff) | |
download | busybox-w32-06936df16411fff0fdc338cae28385d66cabcef8.tar.gz busybox-w32-06936df16411fff0fdc338cae28385d66cabcef8.tar.bz2 busybox-w32-06936df16411fff0fdc338cae28385d66cabcef8.zip |
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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -495,11 +495,12 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir | |||
495 | * while all previous ones get default protections. Errors are not reported | 495 | * while all previous ones get default protections. Errors are not reported |
496 | * here, as failures to restore files can be reported later. | 496 | * here, as failures to restore files can be reported later. |
497 | */ | 497 | */ |
498 | extern void createPath (const char *name, int mode) | 498 | extern int createPath (const char *name, int mode) |
499 | { | 499 | { |
500 | char *cp; | 500 | char *cp; |
501 | char *cpOld; | 501 | char *cpOld; |
502 | char buf[NAME_MAX]; | 502 | char buf[NAME_MAX]; |
503 | int retVal=0; | ||
503 | 504 | ||
504 | strcpy( buf, name); | 505 | strcpy( buf, name); |
505 | cp = strchr (buf, '/'); | 506 | cp = strchr (buf, '/'); |
@@ -507,9 +508,17 @@ extern void createPath (const char *name, int mode) | |||
507 | cpOld = cp; | 508 | cpOld = cp; |
508 | cp = strchr (cp + 1, '/'); | 509 | cp = strchr (cp + 1, '/'); |
509 | *cpOld = '\0'; | 510 | *cpOld = '\0'; |
510 | mkdir (buf, cp ? 0777 : mode); | 511 | retVal = mkdir (buf, cp ? 0777 : mode); |
511 | *cpOld = '/'; | 512 | *cpOld = '/'; |
512 | } | 513 | } |
514 | /* Return the result from the final directory, as that | ||
515 | * is the one that counts */ | ||
516 | if( retVal!=0) { | ||
517 | if ( errno!=EEXIST) { | ||
518 | return( FALSE); | ||
519 | } | ||
520 | } | ||
521 | return( TRUE); | ||
513 | } | 522 | } |
514 | #endif | 523 | #endif |
515 | 524 | ||