#include <stdlib.h>
#include <errno.h>
#include <getopt.h>
+#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
int ret = 1;
struct stat sb;
+ if (faccessat(AT_FDCWD, s, F_OK, AT_SYMLINK_NOFOLLOW) != 0) {
+ warn(_("%s: not accessible"), s);
+ return 2;
+ }
+
if (lstat(s, &sb) == -1) {
warn(_("stat of %s failed"), s);
return 2;
char *newname = NULL, *file=NULL;
int ret = 1;
+ if (access(s, F_OK) != 0) {
+ warn(_("%s: not accessible"), s);
+ return 2;
+ }
+
if (strchr(from, '/') == NULL && strchr(to, '/') == NULL)
file = strrchr(s, '/');
if (file == NULL)
file = s;
if (string_replace(from, to, file, s, &newname))
return 0;
+
if (nooverwrite && access(newname, F_OK) == 0) {
if (verbose)
printf(_("Skipping existing file: `%s'\n"), newname);