diff options
Diffstat (limited to 'lib/tdb/tools/tdbbackup.c')
-rw-r--r-- | lib/tdb/tools/tdbbackup.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/tdb/tools/tdbbackup.c b/lib/tdb/tools/tdbbackup.c index 11ecaa0290..276a281e46 100644 --- a/lib/tdb/tools/tdbbackup.c +++ b/lib/tdb/tools/tdbbackup.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. low level tdb backup and restore utility Copyright (C) Andrew Tridgell 2002 @@ -7,12 +7,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -61,7 +61,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) { va_list ap; - + va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); @@ -122,7 +122,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) } /* open the old tdb */ - tdb = tdb_open_ex(old_name, 0, 0, + tdb = tdb_open_ex(old_name, 0, 0, O_RDWR, 0, &log_ctx, NULL); if (!tdb) { printf("Failed to open %s\n", old_name); @@ -132,10 +132,10 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) /* create the new tdb */ unlink(tmp_name); - tdb_new = tdb_open_ex(tmp_name, - hash_size ? hash_size : tdb_hash_size(tdb), - TDB_DEFAULT, - O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, + tdb_new = tdb_open_ex(tmp_name, + hash_size ? hash_size : tdb_hash_size(tdb), + TDB_DEFAULT, + O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, &log_ctx, NULL); if (!tdb_new) { perror(tmp_name); @@ -192,9 +192,9 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) /* close the new tdb and re-open read-only */ tdb_close(tdb_new); - tdb_new = tdb_open_ex(tmp_name, + tdb_new = tdb_open_ex(tmp_name, 0, - TDB_DEFAULT, + TDB_DEFAULT, O_RDONLY, 0, &log_ctx, NULL); if (!tdb_new) { @@ -204,7 +204,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) free(tmp_name); return 1; } - + /* traverse the new tdb to confirm */ count2 = tdb_traverse(tdb_new, test_fn, NULL); if (count2 != count1) { @@ -237,7 +237,7 @@ static int verify_tdb(const char *fname, const char *bak_name) int count = -1; /* open the tdb */ - tdb = tdb_open_ex(fname, 0, 0, + tdb = tdb_open_ex(fname, 0, 0, O_RDONLY, 0, &log_ctx, NULL); /* traverse the tdb, then close it */ @@ -280,7 +280,6 @@ static void usage(void) printf(" -v verify mode (restore if corrupt)\n"); printf(" -n hashsize set the new hash size for the backup\n"); } - int main(int argc, char *argv[]) { |