From 094306bbfdbaacf2b9920b6dc44a6ee155fea1c5 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 5 Jan 2015 15:44:18 +0100 Subject: 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 --- common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common.c') 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; +} -- cgit v1.2.3