Репозитории ALT
Группа :: Работа с файлами
Пакет: stmpclean
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: stmpclean-0.3-alt-ctime-mtime.patch
Скачать
Скачать
--- stmpclean-0.3/stmpclean.c
+++ stmpclean-0.3/stmpclean.c
@@ -89,7 +89,7 @@ static uid_t start_uid = -1;
static int am_tmpwatch;
/* Time at the start of the program, in seconds since beginning of epoch. */
static time_t now;
-/* Minimum age (atime) of a file or empty directory to be deleted. */
+/* Minimum age (atime/ctime/mtime) of a file or empty directory to be deleted. */
static int minage;
/* Current working directory is used for logging purposes only. */
static char cwd[MAXPATHLEN];
@@ -356,7 +356,10 @@ clean_dir(dir, depth, specified)
/* Looking at a directory. */
if (isemptydir(dp->d_name)) {
/* Looking at an empty directory. */
- if (now - st.st_atime > minage && st.st_uid) {
+ if (st.st_uid
+ && (now - st.st_atime > minage)
+ && (now - st.st_ctime > minage)
+ && (now - st.st_mtime > minage)) {
/* An old non-root owned directory. */
setecreds(st.st_uid, st.st_gid, dir,
dp->d_name);
@@ -393,8 +396,10 @@ notempty:
}
} else {
/* Looking at a non-directory. */
- if ((now - st.st_atime > minage)
- && st.st_uid
+ if (st.st_uid
+ && (now - st.st_atime > minage)
+ && (now - st.st_ctime > minage)
+ && (now - st.st_mtime > minage)
&& (st.st_nlink == 1)
&& (((st.st_mode & S_IFMT) == S_IFREG)
|| ((st.st_mode & S_IFMT) == S_IFLNK))) {