summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog1
-rw-r--r--quotacheck.c27
-rw-r--r--warnquota.c6
3 files changed, 18 insertions, 16 deletions
diff --git a/Changelog b/Changelog
index 0180087..d521df4 100644
--- a/Changelog
+++ b/Changelog
@@ -8,6 +8,7 @@ Changes in quota-tools form 3.10 to 3.11
* fixed typo in quotacheck manpage (Noel Koethe)
* warnquota(8) can get mail addresses via LDAP (James Bourne)
* warnquota(8) can avoid sending e-mail when user is over quota on mail partition (James Bourne)
+* fixed bug in quotacheck(8) which counted directories twice sometimes (Jan Kara)
Changes in quota-tools from 3.09 to 3.10
* alternative port can be specified to rpc.rquotad by -p option (Jan Kara)
diff --git a/quotacheck.c b/quotacheck.c
index f452def..f0ebb35 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.36 2004/01/05 09:34:42 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.37 2004/01/06 12:19:31 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -401,7 +401,7 @@ static int ext2_direct_scan(char *device)
while ((long)i_num) {
if (inode.i_links_count) {
- debug(FL_DEBUG, _("Found i_num %ld, %ld\n"), (long)i_num, (long)inode.i_blocks);
+ debug(FL_DEBUG, _("Found i_num %ld, blocks %ld\n"), (long)i_num, (long)inode.i_blocks);
if (flags & FL_VERBOSE)
blit();
uid = inode.i_uid | (inode.i_uid_high << 16);
@@ -438,7 +438,7 @@ static int ext2_direct_scan(char *device)
*/
static int scan_dir(char *pathname)
{
- struct dirs *dir_stack = { (struct dirs *)NULL };
+ struct dirs *dir_stack = NULL;
struct dirs *new_dir;
struct dirent *de;
struct stat st;
@@ -447,7 +447,7 @@ static int scan_dir(char *pathname)
int ret;
if (lstat(pathname, &st) == -1) {
- errstr(_("Cannot stat root directory %s: %s\n"), pathname, strerror(errno));
+ errstr(_("Cannot stat directory %s: %s\n"), pathname, strerror(errno));
goto out;
}
qspace = getqsize(pathname, &st);
@@ -474,14 +474,6 @@ static int scan_dir(char *pathname)
goto out;
}
- qspace = getqsize(de->d_name, &st);
- if (ucheck)
- add_to_quota(USRQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace, !S_ISDIR(st.st_mode));
- if (gcheck)
- add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace, !S_ISDIR(st.st_mode));
-
if (S_ISDIR(st.st_mode)) {
if (st.st_dev != cur_dev)
continue;
@@ -497,8 +489,15 @@ static int scan_dir(char *pathname)
dir_stack = new_dir;
}
else {
- debug(FL_DEBUG, _("\tAdding %s size %d ino %d links %d\n"), de->d_name,
- st.st_size, st.st_ino, st.st_nlink);
+ qspace = getqsize(de->d_name, &st);
+ if (ucheck)
+ add_to_quota(USRQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
+ st.st_nlink, qspace, 1);
+ if (gcheck)
+ add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
+ st.st_nlink, qspace, 1);
+ debug(FL_DEBUG, _("\tAdding %s size %Ld ino %d links %d uid %u gid %u\n"), de->d_name,
+ (long long)st.st_size, (int)st.st_ino, (int)st.st_nlink, (int)st.st_uid, (int)st.st_gid);
files_done++;
}
}
diff --git a/warnquota.c b/warnquota.c
index 9fd68c8..89df4f6 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -10,7 +10,7 @@
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
- * Version: $Id: warnquota.c,v 1.16 2004/01/05 09:34:42 jkar8572 Exp $
+ * Version: $Id: warnquota.c,v 1.17 2004/01/06 12:19:31 jkar8572 Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -301,8 +301,9 @@ int mail_user(struct offenderlist *offender, struct configparams *config)
char timebuf[MAXTIMELEN];
char numbuf[3][MAXNUMLEN];
struct util_dqblk *dqb;
- char *to = NULL, searchbuf[256];
+ char *to = NULL;
#ifdef USE_LDAP_MAIL_LOOKUP
+ char searchbuf[256];
LDAPMessage *result, *entry;
BerElement *ber = NULL;
struct berval **bvals = NULL;
@@ -863,4 +864,5 @@ int main(int argc, char **argv)
warn_quota();
wc_exit(0);
+ return 0;
}