Fixed a bug where tar would not set the user and group on device
special files. -Erik
This commit is contained in:
		| @@ -10,9 +10,9 @@ | ||||
| 	* Added 'grep -q' thanks to a patch from "Konstantin Boldyshev"  | ||||
| 	    <konst@voshod.com>. | ||||
| 	* Implemented sort. -beppu | ||||
| 	* Fixed tar SGID and SUID bug.  Seems that chown(2) clears S_ISUID and  | ||||
| 	    S_ISGID, even when chown is called as root.  I changed the ordering  | ||||
| 	    of chown and chmod so SGID and SUID file permissions don't get munged. | ||||
| 	* Fixed a bug where tar would set, and then clear SGID and SUID bits. | ||||
| 	* Fixed a bug where tar would not set the user and group on device | ||||
| 	    special files. | ||||
|  | ||||
| 	-Erik Andersen | ||||
|  | ||||
|   | ||||
| @@ -577,17 +577,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | ||||
| 	} else { | ||||
| 	    outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); | ||||
| 	} | ||||
| 	if (outFd < 0) { | ||||
| 	    perror (name); | ||||
| 	    skipFileFlag = TRUE; | ||||
| 	    return; | ||||
| 	} | ||||
| 	chown(name, uid, gid); | ||||
| 	chmod(name, mode); | ||||
|     } | ||||
|  | ||||
|     if (outFd < 0) { | ||||
| 	perror (name); | ||||
| 	skipFileFlag = TRUE; | ||||
| 	return; | ||||
|     } | ||||
|     if (tostdoutFlag == FALSE) { | ||||
| 	fchown(outFd, uid, gid); | ||||
| 	fchmod(outFd, mode); | ||||
|     } | ||||
|  | ||||
|     /*  | ||||
|      * If the file is empty, then that's all we need to do. | ||||
|   | ||||
							
								
								
									
										16
									
								
								tar.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								tar.c
									
									
									
									
									
								
							| @@ -577,17 +577,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | ||||
| 	} else { | ||||
| 	    outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); | ||||
| 	} | ||||
| 	if (outFd < 0) { | ||||
| 	    perror (name); | ||||
| 	    skipFileFlag = TRUE; | ||||
| 	    return; | ||||
| 	} | ||||
| 	chown(name, uid, gid); | ||||
| 	chmod(name, mode); | ||||
|     } | ||||
|  | ||||
|     if (outFd < 0) { | ||||
| 	perror (name); | ||||
| 	skipFileFlag = TRUE; | ||||
| 	return; | ||||
|     } | ||||
|     if (tostdoutFlag == FALSE) { | ||||
| 	fchown(outFd, uid, gid); | ||||
| 	fchmod(outFd, mode); | ||||
|     } | ||||
|  | ||||
|     /*  | ||||
|      * If the file is empty, then that's all we need to do. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user