rhash / RHash

Great utility for computing hash sums
http://rhash.sf.net
BSD Zero Clause License
585 stars 116 forks source link

Fix #251: Retrieve symlink target size on Windows #252

Closed jpovixwm closed 9 months ago

jpovixwm commented 1 year ago

Disclaimer: I don't program in C, so please cut me some slack.

I'm not sure about the usage of _fileno, as I've seen a couple of comments in other parts of the source claiming that it was incompatible with gcc -ansi. However, it's already used in hash_print.c: https://github.com/rhash/RHash/blob/eb536fa8f40074b6881ca00e7fd775a7ae814a41/hash_print.c#L506-L510

The test case was a bit tricky because creating symlinks on Windows generally requires that the process is elevated, or that "Developer Mode" is enabled, which is why I chose to skip the test if the symlink was not created successfully.

I've tested these changes under MSYS2 (UCRT64) and Ubuntu 22.04 (WSL). The test case already passes on Ubuntu if executed against master. Only the Windows implementation required changes to report the file sizes of symlink targets.

rhash commented 9 months ago

Symlink size and time on Windows are fixed by commit https://github.com/rhash/RHash/commit/4a9bfa8d666ddce0da60ccf70a9f9b5fb228e591.