It looks like the code uses st in the if just before the deref_stat coll that fills in st. The following patch moves the deref_stat call before the if, and keeps the return value for the if inside to use, so that the messages and behaviour stays the same, but there is no longer a case of using st uninitialized, assuming stat/lstat never leaves it uninitialized.
I am not quite sure what the code is actually trying to do, although whatever it is, the author of this function made a mistake, and I am amazed the compiler isn't spitting a warning about potentiall using an uninitialized variable. Another option would be to clear st before doing the condition, since at least then you should get consistent behaviour, although probably not the intended behaviour in all cases. Right now I suspect the times when it fails, the value of some field in the st struct happens to be non zero, making S_ISDIR succeed when it should have. -- Len Sorensen
--- incremen.c.ori 2006-08-03 15:08:23.000000000 +0000 +++ incremen.c 2006-08-03 15:09:27.000000000 +0000 @@ -1295,15 +1295,17 @@ { const char *entry; struct stat st; + int deref_stat_return; if (p) free (p); p = new_name (directory_name, cur); + deref_stat_return = deref_stat (false, p, &st); if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur)) || (*entry == 'D' && S_ISDIR (st.st_mode)) || (*entry == 'Y' && !S_ISDIR (st.st_mode))) { - if (deref_stat (false, p, &st)) + if (deref_stat_return) { if (errno != ENOENT) /* FIXME: Maybe keep a list of renamed dirs and check it here? */