|
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 |
aaf488 |
+++ rpm-4.8.0/lib/fsm.c 2010-06-03 11:14:53.000000000 +0300
|
|
Panu Matilainen |
aaf488 |
@@ -1320,6 +1320,21 @@ 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 |
aaf488 |
+ if (lstat(path, &stb) == 0 && S_ISREG(stb.st_mode)) {
|
|
Panu Matilainen |
aaf488 |
+ if ((stb.st_mode & 06000) != 0) {
|
|
Panu Matilainen |
8c454e |
+ (void) chmod(path, stb.st_mode & 0777);
|
|
Panu Matilainen |
8c454e |
+ }
|
|
Panu Matilainen |
aaf488 |
+#if WITH_CAP
|
|
Panu Matilainen |
aaf488 |
+ if (stb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) {
|
|
Panu Matilainen |
aaf488 |
+ (void) cap_set_file(path, NULL);
|
|
Panu Matilainen |
aaf488 |
+ }
|
|
Panu Matilainen |
aaf488 |
+#endif
|
|
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 |
aaf488 |
@@ -2024,11 +2039,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 |
aaf488 |
@@ -2037,6 +2049,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) {
|