version 1.18, 2012/03/04 04:05:15 |
version 1.19, 2014/05/20 01:25:23 |
|
|
flags = O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW; |
flags = O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW; |
if (lstat(outfile, &st) == 0) { |
if (lstat(outfile, &st) == 0) { |
if (iflag) { |
if (iflag) { |
errno = EEXIST; |
warnc(EEXIST, "%s: %s", infile, outfile); |
warn("%s: %s", infile, outfile); |
|
return (0); |
return (0); |
} |
} |
switch (st.st_mode & S_IFMT) { |
switch (st.st_mode & S_IFMT) { |
|
|
warn("%s: unlink %s", infile, outfile); |
warn("%s: unlink %s", infile, outfile); |
return (1); |
return (1); |
case S_IFDIR: |
case S_IFDIR: |
errno = EISDIR; |
warnc(EISDIR, "%s: %s", infile, outfile); |
warn("%s: %s", infile, outfile); |
|
return (1); |
return (1); |
default: |
default: |
if (oflag) { |
if (oflag) { |
|
|
flags &= ~(O_EXCL|O_NOFOLLOW); |
flags &= ~(O_EXCL|O_NOFOLLOW); |
break; |
break; |
} |
} |
errno = EEXIST; |
warnc(EEXIST, "%s: %s", infile, outfile); |
warn("%s: %s", infile, outfile); |
|
return (1); |
return (1); |
} |
} |
} else if (errno != ENOENT) { |
} else if (errno != ENOENT) { |