summaryrefslogtreecommitdiffstats
path: root/bin/pax/ar_io.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2007-05-25 17:53:38 +0000
committerbrian <brian@FreeBSD.org>2007-05-25 17:53:38 +0000
commitca73550609971e5c7642325b1833c7f61f18a18f (patch)
treeabe1f2f38d0cd4adb714e33bc582f7731a902868 /bin/pax/ar_io.c
parentfc73d9965235bd4aa208e7cf8ed01a02284e6ef6 (diff)
downloadFreeBSD-src-ca73550609971e5c7642325b1833c7f61f18a18f.zip
FreeBSD-src-ca73550609971e5c7642325b1833c7f61f18a18f.tar.gz
Remove unnecessary free argument casts.
Don't abuse arcname's constness.
Diffstat (limited to 'bin/pax/ar_io.c')
-rw-r--r--bin/pax/ar_io.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 01eb80b..0946a88 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -1109,8 +1109,8 @@ get_phys(void)
int
ar_next(void)
{
+ static char *arcbuf;
char buf[PAXPATHLEN+2];
- static int freeit = 0;
sigset_t o_mask;
/*
@@ -1228,17 +1228,14 @@ ar_next(void)
* try to open new archive
*/
if (ar_open(buf) >= 0) {
- if (freeit) {
- free((char *)(uintptr_t)arcname);
- freeit = 0;
- }
- if ((arcname = strdup(buf)) == NULL) {
+ free(arcbuf);
+ if ((arcbuf = strdup(buf)) == NULL) {
done = 1;
lstrval = -1;
paxwarn(0, "Cannot save archive name.");
return(-1);
}
- freeit = 1;
+ arcname = arcbuf;
break;
}
tty_prnt("Cannot open %s, try again\n", buf);
OpenPOWER on IntegriCloud