summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2008-08-21 11:19:09 +0000
committerjkar8572 <jkar8572>2008-08-21 11:19:09 +0000
commit1069b78a6ff95399a5f0ed2b9116f6ab94fb67a1 (patch)
tree4b6f68e4d5e9c6377e981d829e3371ecff38b4e0
parent88e403c035811681fbe472566b6ae411ed1e2f5c (diff)
* remove IMMUTABLE flag from quota file in quotacheck (Jan Kara)
-rw-r--r--Changelog1
-rw-r--r--quotacheck.c14
2 files changed, 14 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index ed9eace..195550b 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
Changes in quota-tools from 3.16 to 3.17
+* remove IMMUTABLE flag from quota file in quotacheck (Jan Kara)
* fix bug in warnquota which could result in bogus hostname and domainname (anonymous reporter)
* implemented writing of messages that user got below hard/soft limits to quota_nld (Jan Kara)
* use PKG_CHECK_MODULES to check for DBUS (Ladislav Michnovic)
diff --git a/quotacheck.c b/quotacheck.c
index de1360d..209fc97 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -8,7 +8,7 @@
* New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR
*/
-#ident "$Id: quotacheck.c,v 1.55 2008/04/21 15:37:42 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.56 2008/08/21 11:19:09 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -721,6 +721,18 @@ static int rename_files(struct mntent *mnt, int type)
}
if (ioctl(fd, EXT2_IOC_GETFLAGS, &ext2_flags) < 0)
debug(FL_DEBUG, _("EXT2_IOC_GETFLAGS failed: %s\n"), strerror(errno));
+ /* IMMUTABLE flag set probably because system crashed and quota was not properly
+ * turned off */
+ if (ext2_flags & EXT2_IMMUTABLE_FL) {
+ debug(FL_DEBUG | FL_VERBOSE, _("Quota file %s has IMMUTABLE flag set. Clearing.\n"), filename);
+ ext2_flags &= ~EXT2_IMMUTABLE_FL;
+ if (ioctl(fd, EXT2_IOC_SETFLAGS, &ext2_flags) < 0) {
+ errstr(_("Failed to remove IMMUTABLE flag from quota file %s: %s\n"), filename, strerror(errno));
+ free(filename);
+ close(fd);
+ return -1;
+ }
+ }
close(fd);
#endif
if (flags & FL_BACKUPS) {