Ensure script to run is not a directory

This commit is contained in:
Arun Prakash Jana 2018-12-08 18:44:28 +05:30
parent 08cfcfea59
commit 70d1b0d4d8
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -3404,12 +3404,17 @@ nochange:
tmp = newpath;
}
/* Check if file exists */
if (access(tmp, F_OK) == -1) {
if (lstat(tmp, &sb) == -1) {
printwarn();
goto nochange;
}
/* Check if it's a directory */
if (S_ISDIR(sb.st_mode)) {
printmsg("directory");
goto nochange;
}
dir = NULL; /* dir used as temp var */
if (ndents)
dir = dents[cur].name;