-
Notifications
You must be signed in to change notification settings - Fork 8.1k
WIP: Fix libpsl-native to build and pass tests on FreeBSD #7208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,5 +31,11 @@ bool IsFile(const char* path) | |
| assert(path); | ||
|
|
||
| struct stat buf; | ||
| return lstat(path, &buf) == 0; | ||
| if (lstat(path, &buf) == -1) | ||
| { | ||
| // TODO: throw error on path doesn't exist? | ||
| return false; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If path does not exist, is returning false enough?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unit test test-isfile.cpp currently expects false for a file that does not exit. See https://github.com/PowerShell/PowerShell/blob/master/src/libpsl-native/test/test-isfile.cpp
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I would suggest testing for path before using it; something like the following: if (path == NULL || lstat(path, &buf) == -1) |
||
| } | ||
|
|
||
| return S_ISDIR(buf.st_mode) == 0; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ki_uidreturns effective user id, where aski_ruidreturns real user id andki_svuidreturns saved effective user id. Which one should we look for in this case?