GNOME Bugzilla – Bug 698348
glocalfile.c build fix
Last modified: 2014-01-20 06:08:50 UTC
In is_remote_fs(), statfs_result is also used in the USE_STATVFS case. (I was tempted to s/statfs_result/retval/ but didn't - would that be preferred?)
Created attachment 241885 [details] [review] glocalfile statvfs compile fix
ping? Surely this is trivially correct and can be applied!
Review of attachment 241885 [details] [review]: Sorry for ignoring this -- it fell through the cracks. Your fix isn't _quite_ right because then this would be an unused variable in the #else case (not USE_STATFS and not USE_STATVFS). I think the correct fix is rather to copy the variable declaration down to under the #elif below. Feel free to rename it if you like.
we've been dealing with the spaghetti ifdefs in that file for quite a while now - maybe we should clean that up for real...
That code is new -- it was for our detect-NFS-and-use-FAM thing. Unfortunately the spaghetti is required. Best we could do, really, is split it into some different functions.
I think the fact that Patrick's fix contained another bug is a pretty good sign that the spaghetti has won, and we need to find a better way to organize this code.
Actually, it isn't that obvious that it contains another bug: outside all #ifdefs, there is a "if (statfs_result == -1)", so I thought that declaring statfs_result outside of all #ifdefs was a good idea as it is referenced outside of all #ifdefs. If you think there will be an unused variable warning, you have to take into account the "return" before that line is reached... (Either way, the warning is better than the error) Agreed that the spaghetti is getting fiddly, but in glocalfile.c it is only that one function is_remote_fs which is tricky (as opposed to gunixmounts.c which could probably do with being split into separate files...)
Created attachment 245784 [details] [review] repeated declaration in #ifdef USE_STATVFS section This version duplicates the declaration as suggested. I didn't rename the variable in the end as it all has a certain symmetry.
Same problem also on Solaris, same patch works fine. Please apply a fix for the next version.
It seems that my patch was rediscovered 3 months later by Igor in Bug 704587. He was luckier in getting it applied...
*** Bug 697166 has been marked as a duplicate of this bug. ***