<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH 03 of 16] Since contex_sb might be uninitialized, it is



>>>>> @@ -285,12 +288,6 @@
>>>>> #ifdef USE_POP
>>>>>  if (!Context || Context->magic != M_POP)
>>>>> #endif
>>>>> -  /* check device ID and serial number instead of comparing paths */
>>>>> -  if (!Context || !Context->path || stat (Context->path, &contex_sb) !=
>>>>> 0)
>>>>> -  {
>>>>> -    contex_sb.st_dev=0;
>>>>> -    contex_sb.st_ino=0;
>>>>> -  }
>>
>>> I don't disagree w/ you. But the result of the if statement is useless if
>>> the value is initialized before hand.
>>
>> The problem is that you remove the stat() call which is the only place
>> contex_sb is filled with values. To initialize it I think we want
>> something like this:
>>
>>        contex_sb.st_dev = 0;
>>        contex_sb.st_ino = 0;
>>
>>        [...]
>>
>>        if (Context && Context->path)
>>          stat (Context->path, &contex_sb);
>
> Feel free to ignore my patch on this one. I will gin up another one if
> I get a better fix.

Here is a simpler fix for this issue. stat() is unchanged, but the
values of st_dev and st_ino are initialized at the begining.

E

-- 
Erik Hovland
erik@xxxxxxxxxxx
http://hovland.org/
diff -r d752330561da buffy.c
--- a/buffy.c   Mon Mar 16 15:55:08 2009 -0700
+++ b/buffy.c   Tue Mar 17 13:36:53 2009 -0700
@@ -261,6 +261,8 @@
   time_t t;
 
   sb.st_size=0;
+  contex_sb.st_dev=0;
+  contex_sb.st_ino=0;
 #ifdef USE_IMAP
   /* update postponed count as well, on force */
   if (force)