summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2002-03-27 16:40:27 +0000
committerjkar8572 <jkar8572>2002-03-27 16:40:27 +0000
commitadb5b187b252912f1853722477b04db8b5f0aaed (patch)
tree1f2422b1e9d90e70a5b5c6efbe950082e84854be
parent5975341695e27f23f5a58758954d1ea31c2d0d25 (diff)
Fixed bug in quota format detection - avoid SIGSEGV on old kernels. (Jan Kara)
-rw-r--r--Changelog1
-rw-r--r--quotasys.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/Changelog b/Changelog
index 7460bde..7d899a6 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ Changes in quota-tools from 3.04 to 3.05
* added support for quota 6.5.1 (Jan Kara)
* quotaon(8) now can get format parameter (Jan Kara)
* fixed bad return value of quota(1) (Jan Kara)
+* fixed bug in quota format format detection (Jan Kara)
Changes in quota-tools from 3.03 to 3.04
* added -D_FILE_OFFSET_BITS=64 to Makefile - fixes problems with large files with some libcs (Michael Meskes)
diff --git a/quotasys.c b/quotasys.c
index 8b1feec..77d8c83 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -15,6 +15,7 @@
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
+#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/vfs.h>
@@ -542,9 +543,18 @@ void init_kernel_interface(void)
}
else {
struct v2_dqstats v2_stats;
+ struct sigaction sig, oldsig;
if (!stat("/proc/fs/xfs/stat", &st))
kernel_formats |= (1 << QF_XFS);
+ /* This signal handling is needed because old kernels send us SIGSEGV as they try to resolve the device */
+ sig.sa_handler = SIG_IGN;
+ sig.sa_sigaction = NULL;
+ if (sigemptyset(&sig.sa_mask) < 0)
+ die(2, _("Can't create set for sigaction(): %s\n"), strerror(errno));
+ sig.sa_flags = 0;
+ if (sigaction(SIGSEGV, &sig, &oldsig) < 0)
+ die(2, _("Can't set signal handler: %s\n"), strerror(errno));
if (quotactl(QCMD(Q_V2_GETSTATS, 0), NULL, 0, (void *)&v2_stats) >= 0) {
version = v2_stats.version;
kernel_formats |= (1 << QF_VFSV0);
@@ -578,6 +588,8 @@ void init_kernel_interface(void)
version = 6*10000+4*100+0;
}
}
+ if (sigaction(SIGSEGV, &oldsig, NULL) < 0)
+ die(2, _("Can't reset signal handler: %s\n"), strerror(errno));
}
if (version > KERN_KNOWN_QUOTA_VERSION)