Blob Blame History Raw
diff -urNp quota-tools-orig/quotacheck.c quota-tools/quotacheck.c
--- quota-tools-orig/quotacheck.c	2008-08-27 14:27:10.000000000 +0200
+++ quota-tools/quotacheck.c	2008-08-27 14:32:11.000000000 +0200
@@ -721,6 +721,19 @@ static int rename_files(struct mntent *m
 	}
 	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) {
diff -urNp quota-tools-orig/warnquota.c quota-tools/warnquota.c
--- quota-tools-orig/warnquota.c	2007-08-23 16:05:49.000000000 +0200
+++ quota-tools/warnquota.c	2008-08-27 14:28:13.000000000 +0200
@@ -1052,8 +1052,8 @@ static void get_host_name(void)
 
 	if (uname(&uts))
 		die(1, _("Cannot get host name: %s\n"), strerror(errno));
-	hostname = uts.nodename;
-	domainname = uts.domainname;
+	hostname = sstrdup(uts.nodename);
+	domainname = sstrdup(uts.domainname);
 }
 
 int main(int argc, char **argv)