Exemplo n.º 1
0
static int set_file_times(const char *path, struct utimbuf *ut, struct stat *statp, struct cntr *cntr)
{
	int e;
// The mingw64 utime() appears not to work on directories.
// Use the utime() from bacula instead.
#ifdef HAVE_WIN32
	if(S_ISDIR(statp->st_mode)) e=win32_utime(path, ut);
	else e=utime(path, ut);
#else
	e=utime(path, ut);
#endif
	if(e<0)
	{
		berrno be;
		logw(cntr, "Unable to set file times %s: ERR=%s",
			path, be.bstrerror());
		return -1;
	}
	return 0;
}
Exemplo n.º 2
0
static int set_file_times(struct asfd *asfd,
	const char *path, struct utimbuf *ut,
	struct stat *statp, struct conf *conf)
{
	int e;
// The mingw64 utime() appears not to work on read-only files.
// Use the utime() from bacula instead.
#ifdef HAVE_WIN32
	//e=utime(path, ut);
	e=win32_utime(path, ut);
#else
	e=utime(path, ut);
#endif
	if(e<0)
	{
		berrno be;
		berrno_init(&be);
		logw(asfd, conf, "Unable to set file times %s: ERR=%s",
			path, berrno_bstrerror(&be, errno));
		return -1;
	}
	return 0;
}