From 00266d3df6ba8dcc6247f112372a0ce5a8ab2c32 Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Tue, 28 Dec 1999 00:17:46 +0000 Subject: Fixed a bug where tar would not set the user and group on device special files. -Erik --- tar.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tar.c') diff --git a/tar.c b/tar.c index bff248212..7167d95cd 100644 --- a/tar.c +++ b/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. -- cgit v1.2.3