Commit c220c2f9 authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Tune up false perror message

When linkat fails in uns we print error (!) and then sometimes
try some other way to linkat anyway %). Fix this place not
to produce the error message all the time, but only when it's
needed.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent de2b4261
......@@ -1195,10 +1195,15 @@ static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t owner
int errno_save;
ret = linkat(odir, opath, ndir, npath, 0);
if (ret < 0)
if (ret == 0)
return 0;
if (!( (errno == EPERM) && (root_ns_mask & CLONE_NEWUSER) )) {
errno_save = errno;
pr_perror("Can't link %s -> %s", opath, npath);
if (ret == 0 || errno != EPERM || !(root_ns_mask & CLONE_NEWUSER))
errno = errno_save;
return ret;
}
/*
* Kernel before 4.3 has strange secutiry restrictions about
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment