* Backup handling code.
*
* Copyright (C) 1999 Andrew Tridgell
- * Copyright (C) 2003-2015 Wayne Davison
+ * Copyright (C) 2003-2020 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
char *get_backup_name(const char *fname)
{
if (backup_dir) {
+ static int initialized = 0;
+ if (!initialized) {
+ int ret;
+ if (backup_dir_len > 1)
+ backup_dir_buf[backup_dir_len-1] = '\0';
+ ret = make_path(backup_dir_buf, 0);
+ if (backup_dir_len > 1)
+ backup_dir_buf[backup_dir_len-1] = '/';
+ if (ret < 0)
+ return NULL;
+ initialized = 1;
+ }
/* copy fname into backup_dir_buf while validating the dirs. */
if (copy_valid_path(fname))
return backup_dir_buf;
save_preserve_xattrs = preserve_xattrs;
preserve_xattrs = 0;
- set_file_attrs(buf, file, NULL, fname, 0);
+ set_file_attrs(buf, file, NULL, fname, ATTRS_ACCURATE_TIME);
preserve_xattrs = save_preserve_xattrs;
unmake_file(file);