Closed ChampionL closed 9 years ago
We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/84831044.
The first check asserts that it exists. The second asserts that it is a directory (as opposed to e.g. a file). if a file exists at the passed path rather than a directory the first stat will succeed but the S_ISDIR check will fail. This is why the second check is needed.
@julz Thank You
The first check is for the existence of a directory or a file, so the other check is needed to ensure it really is a directory and not a file.
warden/warden/src/wsh/wshd.c line 143 void assert_directory(const char *path) is it below code unnessary? if (!S_ISDIR(st.st_mode)) { fprintf(stderr, "stat(\"%s\"): %s\n", path, "No such directory"); exit(1); } because stat function already check the condition that directory does not exist。why we need to check it again,does this code will never execute?