Handle directories correctly.
PR: 40801 MFC after: 5 days
This commit is contained in:
parent
2999e9faca
commit
4d01a8fb5f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100546
@ -186,8 +186,11 @@ main(argc, argv)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Try reading/writing. */
|
/* Try reading/writing. */
|
||||||
if (rw(*argv, &sb, fflag))
|
if (!S_ISLNK(sb.st_mode) && !S_ISDIR(sb.st_mode) &&
|
||||||
|
rw(*argv, &sb, fflag))
|
||||||
rval = 1;
|
rval = 1;
|
||||||
|
else
|
||||||
|
warn("%s", *argv);
|
||||||
}
|
}
|
||||||
exit(rval);
|
exit(rval);
|
||||||
}
|
}
|
||||||
@ -312,8 +315,8 @@ rw(fname, sbp, force)
|
|||||||
int fd, needed_chmod, rval;
|
int fd, needed_chmod, rval;
|
||||||
u_char byte;
|
u_char byte;
|
||||||
|
|
||||||
/* Try regular files and directories. */
|
/* Try regular files. */
|
||||||
if (!S_ISREG(sbp->st_mode) && !S_ISDIR(sbp->st_mode)) {
|
if (!S_ISREG(sbp->st_mode)) {
|
||||||
warnx("%s: %s", fname, strerror(EFTYPE));
|
warnx("%s: %s", fname, strerror(EFTYPE));
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user