summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-01-05 15:44:18 +0100
committerJan Kara <jack@suse.cz>2015-01-05 17:12:56 +0100
commit094306bbfdbaacf2b9920b6dc44a6ee155fea1c5 (patch)
tree58cfc19395a7ba71388ded03bd7b814860802f94 /common.c
parent33160239630e668413bcb915490f604f2870309a (diff)
edquota: Do not unnecessarily overwrite limits/times
When user doesn't edit the file with limits / grace times, there is no need to overwrite the values in quota files. Maybe admin really wanted to cancel the operation by not writing the file. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'common.c')
-rw-r--r--common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/common.c b/common.c
index 8f87202..d11e602 100644
--- a/common.c
+++ b/common.c
@@ -125,3 +125,16 @@ void version(void)
printf(_("Compiled with:%s\n"), COMPILE_OPTS);
printf(_("Bugs to %s\n"), PACKAGE_BUGREPORT);
}
+
+int timespec_cmp(struct timespec *a, struct timespec *b)
+{
+ if (a->tv_sec < b->tv_sec)
+ return -1;
+ if (a->tv_sec > b->tv_sec)
+ return 1;
+ if (a->tv_nsec < b->tv_nsec)
+ return -1;
+ if (a->tv_nsec > b->tv_nsec)
+ return 1;
+ return 0;
+}