b944a1a
Avoid memory corruption of NULL address.
b944a1a
b944a1a
Backport of
b944a1a
<https://sourceforge.net/tracker/?func=detail&aid=2996418&group_id=18136&atid=118136>
b944a1a
and n+2nd CVS commit.
b944a1a
b944a1a
diff --git a/quotasys.c b/quotasys.c
b944a1a
index 9a7f440..0a4a609 100644
b944a1a
--- a/quotasys.c
b944a1a
+++ b/quotasys.c
b944a1a
@@ -707,9 +707,12 @@ void init_kernel_interface(void)
b944a1a
 	kernel_formats = 0;
b944a1a
 	if (!stat("/proc/fs/xfs/stat", &st))
b944a1a
 		kernel_formats |= (1 << QF_XFS);
b944a1a
-	else
b944a1a
-		if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, NULL) || (errno != EINVAL && errno != ENOSYS))
b944a1a
+	else {
b944a1a
+		fs_quota_stat_t dummy;
b944a1a
+
b944a1a
+		if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
b944a1a
 			kernel_formats |= (1 << QF_XFS);
b944a1a
+	}
b944a1a
 	/* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
b944a1a
 	if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) {
b944a1a
 		kernel_iface = IFACE_GENERIC;