Created attachment 64218 [details] [review]
patch for rename bug on CIFS mounted shares.
When a filesystem is mounted with 'smbfs', or as a shared folder in VirtualBox, and the filesystem host is a Windows system, 'makedepend' will fail when it tries to rename the target makefile. It's been recognized that this operation doesn't work, for there is conditional code to handle it when the target OS is WIN32, UNIXOS2, or CYGWIN. The problem is that if the program has opened the 'makefile', and has an active file descriptor to the file, the 'rename()' function won't work.
A modest rewrite of the code will allow it to work for all OS's, and avoid the conditional code. The check for file exists can be made by handing the return from 'stat()' in the case when "-f" has specified the 'makefile'.
Please see attached patch.
Thanks. I've tweaked the patch a little, so that if the file isn't readable
we don't leave it under the backup name but move it back to the original name,
and posted it to xorg-devel for review:
Thanks, revised patch has been pushed to git master for the next release: