/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
+ Copyright (C) 2000-2017 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
return;
}
-
/* Do casting according to unknown type to keep compiler happy */
#ifdef HAVE_TYPEOF
#define plug(st, val) st = (typeof st)val
bool ok = true;
boffset_t fsize;
- if (uid_set) {
+ if (!uid_set) {
my_uid = getuid();
my_gid = getgid();
uid_set = true;
* try to do a chmod as that will update the file behind it.
*/
if (attr->type == FT_LNK) {
+#ifdef HAVE_LCHOWN
/* Change owner of link, not of real file */
if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
berrno be;
attr->ofname, be.bstrerror());
ok = false;
}
+#endif
+#ifdef HAVE_LUTIMES
+ struct timeval times[2];
+ times[0].tv_sec = attr->statp.st_atime;
+ times[0].tv_usec = 0;
+ times[1].tv_sec = attr->statp.st_mtime;
+ times[1].tv_usec = 0;
+ if (lutimes(attr->ofname, times) < 0 && print_error) {
+ berrno be;
+ Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
+ attr->ofname, be.bstrerror());
+ ok = false;
+ }
+#endif
} else {
/*
* At this point, we have a file that is not a LINK