|
Panu Matilainen |
8c454e |
diff -up rpm-4.8.0/lib/fsm.c.fsm-sbits rpm-4.8.0/lib/fsm.c
|
|
Panu Matilainen |
8c454e |
--- rpm-4.8.0/lib/fsm.c.fsm-sbits 2009-12-07 16:36:49.000000000 +0200
|
|
Panu Matilainen |
8c454e |
+++ rpm-4.8.0/lib/fsm.c 2010-06-02 09:25:52.000000000 +0300
|
|
Panu Matilainen |
8c454e |
@@ -1320,6 +1320,16 @@ static const char * rpmteTypeString(rpmt
|
|
Panu Matilainen |
8c454e |
}
|
|
Panu Matilainen |
8c454e |
}
|
|
Panu Matilainen |
8c454e |
|
|
Panu Matilainen |
8c454e |
+static void removeSBITS(const char *path)
|
|
Panu Matilainen |
8c454e |
+{
|
|
Panu Matilainen |
8c454e |
+ struct stat stb;
|
|
Panu Matilainen |
8c454e |
+ if (lstat(path, &stb) == 0) {
|
|
Panu Matilainen |
8c454e |
+ if (S_ISREG(stb.st_mode) && (stb.st_mode & 06000) != 0) {
|
|
Panu Matilainen |
8c454e |
+ (void) chmod(path, stb.st_mode & 0777);
|
|
Panu Matilainen |
8c454e |
+ }
|
|
Panu Matilainen |
8c454e |
+ }
|
|
Panu Matilainen |
8c454e |
+}
|
|
Panu Matilainen |
8c454e |
+
|
|
Panu Matilainen |
8c454e |
#define IS_DEV_LOG(_x) \
|
|
Panu Matilainen |
8c454e |
((_x) != NULL && strlen(_x) >= (sizeof("/dev/log")-1) && \
|
|
Panu Matilainen |
8c454e |
rstreqn((_x), "/dev/log", sizeof("/dev/log")-1) && \
|
|
Panu Matilainen |
8c454e |
@@ -2024,11 +2034,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS
|
|
Panu Matilainen |
8c454e |
break;
|
|
Panu Matilainen |
8c454e |
|
|
Panu Matilainen |
8c454e |
case FSM_UNLINK:
|
|
Panu Matilainen |
8c454e |
- if (fsm->mapFlags & CPIO_SBIT_CHECK) {
|
|
Panu Matilainen |
8c454e |
- struct stat stb;
|
|
Panu Matilainen |
8c454e |
- if (lstat(fsm->path, &stb) == 0 && S_ISREG(stb.st_mode) && (stb.st_mode & 06000) != 0)
|
|
Panu Matilainen |
8c454e |
- chmod(fsm->path, stb.st_mode & 0777);
|
|
Panu Matilainen |
8c454e |
- }
|
|
Panu Matilainen |
8c454e |
+ if (fsm->mapFlags & CPIO_SBIT_CHECK)
|
|
Panu Matilainen |
8c454e |
+ removeSBITS(fsm->path);
|
|
Panu Matilainen |
8c454e |
rc = unlink(fsm->path);
|
|
Panu Matilainen |
8c454e |
if (_fsm_debug && (stage & FSM_SYSCALL))
|
|
Panu Matilainen |
8c454e |
rpmlog(RPMLOG_DEBUG, " %8s (%s) %s\n", cur,
|
|
Panu Matilainen |
8c454e |
@@ -2037,6 +2044,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS
|
|
Panu Matilainen |
8c454e |
rc = (errno == ENOENT ? CPIOERR_ENOENT : CPIOERR_UNLINK_FAILED);
|
|
Panu Matilainen |
8c454e |
break;
|
|
Panu Matilainen |
8c454e |
case FSM_RENAME:
|
|
Panu Matilainen |
8c454e |
+ if (fsm->mapFlags & CPIO_SBIT_CHECK)
|
|
Panu Matilainen |
8c454e |
+ removeSBITS(fsm->path);
|
|
Panu Matilainen |
8c454e |
rc = rename(fsm->opath, fsm->path);
|
|
Panu Matilainen |
8c454e |
#if defined(ETXTBSY) && defined(__HPUX__)
|
|
Panu Matilainen |
8c454e |
if (rc && errno == ETXTBSY) {
|