-
Notifications
You must be signed in to change notification settings - Fork 333
win32: Fix enumerate root dir content on SFTP-server #148
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
win32: Fix enumerate root dir content on SFTP-server #148
Conversation
remittor
commented
May 24, 2017
•
edited
Loading
edited
09138e2
to
02fc287
Compare
Enum logical drives using GetLogicalDriveStringsW.
02fc287
to
ecdb393
Compare
|
||
/* Detect root dir */ | ||
if (path && strcmp(path, "/") == 0) { | ||
buf->st_mode = _S_IFDIR | _S_IREAD | 0xFF; |
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.
0xff is not required here?
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.
I think this can also be removed..
/* Detect root dir */ | ||
if (path && strcmp(path, "/") == 0) { | ||
buf->st_mode = _S_IFDIR | _S_IREAD | 0xFF; | ||
buf->st_dev = USHRT_MAX; // rootdir flag |
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.
Use ATTR_ROOTDIR to be consistent..
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.
ATTR_ROOTDIR is 32 bit
buf->st_dev is 16 bit
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.
what is the need for setting this here as we are not using this any where else?
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.
You can remove this line, if it so cuts your eyes.
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.
We should remove the unnecessary code so its easy to maintain the long run..
continue; | ||
|
||
x = GetDiskFreeSpaceExW(p, NULL, &totalNumberOfBytes, NULL); | ||
if (!x || totalNumberOfBytes.QuadPart == 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.
I think, we can remove "totalNumberOfBytes.QuadPart == 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.
Var totalNumberOfBytes.QuadPart equ 0 when CD-drive have not CD-disk.
memset(buf, 0, sizeof(struct _stat64)); | ||
|
||
/* Detect root dir */ | ||
if (path && strcmp(path, "/") == 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.
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.
I tested this PR in WinSCP and Bitvise SFTP-clients.