summaryrefslogtreecommitdiff
path: root/source3/tdb/tdbbackup.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
committerAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
commite90b65284812aaa5ff9e9935ce9bbad7791cbbcd (patch)
tree9e744d1dc2f93934a4b49166a37383d3cb2b2139 /source3/tdb/tdbbackup.c
parentec167dc9cc0ec2ee461837c25a371d2981744208 (diff)
downloadsamba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.gz
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.bz2
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.zip
updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
Diffstat (limited to 'source3/tdb/tdbbackup.c')
-rw-r--r--source3/tdb/tdbbackup.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/tdb/tdbbackup.c b/source3/tdb/tdbbackup.c
index 48c4272d33..f59f98a90f 100644
--- a/source3/tdb/tdbbackup.c
+++ b/source3/tdb/tdbbackup.c
@@ -224,6 +224,21 @@ static int verify_tdb(const char *fname, const char *bak_name)
}
+/*
+ see if one file is newer than another
+*/
+static int file_newer(const char *fname1, const char *fname2)
+{
+ struct stat st1, st2;
+ if (stat(fname1, &st1) != 0) {
+ return 0;
+ }
+ if (stat(fname2, &st2) != 0) {
+ return 1;
+ }
+ return (st1.st_mtime > st2.st_mtime);
+}
+
static void usage(void)
{
printf("Usage: tdbbackup [options] <fname...>\n\n");
@@ -276,7 +291,8 @@ static void usage(void)
ret = 1;
}
} else {
- if (backup_tdb(fname, bak_name) != 0) {
+ if (file_newer(fname, bak_name) &&
+ backup_tdb(fname, bak_name) != 0) {
ret = 1;
}
}