diff options
author | Jindrich Novy <jnovy@redhat.com> | 2008-04-29 15:01:05 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2008-04-29 15:01:05 +0200 |
commit | 67f9ca7e1404fc85ad367d5eb9b90f8c5501ebad (patch) | |
tree | e3cb904fa71023b483b5e6050fe02e46343e5508 | |
parent | 498677dad2abb860ca6acd5aaa7aa0ef6d288267 (diff) | |
download | rpm-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.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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)) |