summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2008-04-29 15:01:05 +0200
committerJindrich Novy <jnovy@redhat.com>2008-04-29 15:01:05 +0200
commit67f9ca7e1404fc85ad367d5eb9b90f8c5501ebad (patch)
treee3cb904fa71023b483b5e6050fe02e46343e5508
parent498677dad2abb860ca6acd5aaa7aa0ef6d288267 (diff)
downloadrpm-67f9ca7e1404fc85ad367d5eb9b90f8c5501ebad.tar.gz
rpm-67f9ca7e1404fc85ad367d5eb9b90f8c5501ebad.tar.bz2
rpm-67f9ca7e1404fc85ad367d5eb9b90f8c5501ebad.zip
Avoid general ETXBSY and allow it for HP-UX exclusively
- for more info: http://www.uwsg.iu.edu/hypermail/linux/kernel/9808.3/0883.html - remove the rest of alloca()s
-rw-r--r--lib/fsm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/fsm.c b/lib/fsm.c
index 41882db41..717982ee8 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1890,19 +1890,18 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
break;
}
if (S_ISREG(st->st_mode)) {
- char * path = alloca(strlen(fsm->path) + sizeof("-RPMDELETE"));
- (void) stpcpy( stpcpy(path, fsm->path), "-RPMDELETE");
/*
* XXX HP-UX (and other os'es) don't permit unlink on busy
* XXX files.
*/
fsm->opath = fsm->path;
- fsm->path = path;
+ fsm->path = rstrscat(NULL, fsm->path, "-RPMDELETE", NULL);
rc = fsmNext(fsm, FSM_RENAME);
if (!rc)
(void) fsmNext(fsm, FSM_UNLINK);
else
rc = CPIOERR_UNLINK_FAILED;
+ free(fsm->path);
fsm->path = fsm->opath;
fsm->opath = NULL;
return (rc ? rc : CPIOERR_ENOENT); /* XXX HACK */
@@ -1954,16 +1953,17 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
break;
case FSM_RENAME:
rc = rename(fsm->opath, fsm->path);
-#if defined(ETXTBSY)
+#if defined(ETXTBSY) && defined(__HPUX__)
if (rc && errno == ETXTBSY) {
- char * path = alloca(strlen(fsm->path) + sizeof("-RPMDELETE"));
- (void) stpcpy( stpcpy(path, fsm->path), "-RPMDELETE");
+ char *path = NULL;
+ rstrscat(&path, fsm->path, "-RPMDELETE", NULL);
/*
* XXX HP-UX (and other os'es) don't permit rename to busy
* XXX files.
*/
rc = rename(fsm->path, path);
if (!rc) rc = rename(fsm->opath, fsm->path);
+ free(path);
}
#endif
if (_fsm_debug && (stage & FSM_SYSCALL))