Check a return value from 'g_stat()'
Some Mixbus users (on Windows) have reported seeing ludicrously high figures for the amount of disk space that'll be recovered if they choose to clean up unused sources. I can't see anything obviously wrong in Ardour's code - except for one situation where we don't check a return value after calling 'g_stat()'. On Windows, the relevant path should be (hopefully!) in UTF8 format and the first thing that g_stat() does is to convert it to UTF16. If that conversion fails for some reason, g_stat() will return an error status and statbuf will be uninitialized - but at the moment, we're not checking this. As an experiment, let's check the returned value and find out if these user reports go away. Unfortunately, if it does fix the problem then we've got an even bigger problem - because somehow, a Windows user can create source files with invalid names which can't be later deleted!!
This commit is contained in:
parent
3b7cb8275a
commit
83b48f5cc4
@ -3304,7 +3304,7 @@ Session::cleanup_sources (CleanupReport& rep)
|
||||
|
||||
}
|
||||
|
||||
g_stat ((*x).c_str(), &statbuf);
|
||||
if (0 == g_stat ((*x).c_str(), &statbuf)) {
|
||||
|
||||
if (::rename ((*x).c_str(), newpath.c_str()) != 0) {
|
||||
error << string_compose (_("cannot rename unused file source from %1 to %2 (%3)"), (*x), newpath, strerror (errno)) << endmsg;
|
||||
@ -3335,6 +3335,7 @@ Session::cleanup_sources (CleanupReport& rep)
|
||||
rep.paths.push_back (*x);
|
||||
rep.space += statbuf.st_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* dump the history list */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user