MCPcopy Create free account
hub / github.com/RsyncProject/rsync / set_times

Function set_times

util1.c:121–181  ·  view source on GitHub ↗

This returns 0 for success, 1 for a symlink if symlink time-setting * is not possible, or -1 for any other error. */

Source from the content-addressed store, hash-verified

119/* This returns 0 for success, 1 for a symlink if symlink time-setting
120 * is not possible, or -1 for any other error. */
121int set_times(const char *fname, STRUCT_STAT *stp)
122{
123 static int switch_step = 0;
124
125 if (DEBUG_GTE(TIME, 1)) {
126 rprintf(FINFO,
127 "set modtime, atime of %s to (%ld) %s, (%ld) %s\n",
128 fname, (long)stp->st_mtime,
129 timestring(stp->st_mtime), (long)stp->st_atime, timestring(stp->st_atime));
130 }
131
132 switch (switch_step) {
133#ifdef HAVE_SETATTRLIST
134#include "case_N.h"
135 if (do_setattrlist_times(fname, stp) == 0)
136 break;
137 if (errno != ENOSYS)
138 return -1;
139 switch_step++;
140#endif
141
142#ifdef HAVE_UTIMENSAT
143#include "case_N.h"
144 if (do_utimensat_at(fname, stp) == 0)
145 break;
146 if (errno != ENOSYS)
147 return -1;
148 switch_step++;
149#endif
150
151#ifdef HAVE_LUTIMES
152#include "case_N.h"
153 if (do_lutimes(fname, stp) == 0)
154 break;
155 if (errno != ENOSYS)
156 return -1;
157 switch_step++;
158#endif
159
160#include "case_N.h"
161 switch_step++;
162 if (!omit_link_times) {
163 omit_link_times = 1;
164 if (S_ISLNK(stp->st_mode))
165 return 1;
166 }
167
168#include "case_N.h"
169#ifdef HAVE_UTIMES
170 if (do_utimes(fname, stp) == 0)
171 break;
172#else
173 if (do_utime(fname, stp) == 0)
174 break;
175#endif
176
177 return -1;
178 }

Callers 2

set_file_attrsFunction · 0.85
touch_up_dirsFunction · 0.85

Calls 7

timestringFunction · 0.85
do_setattrlist_timesFunction · 0.85
do_utimensat_atFunction · 0.85
do_lutimesFunction · 0.85
do_utimesFunction · 0.85
do_utimeFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected