[2579] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH] Don't try to load default subs if zephyr has not been

daemon@ATHENA.MIT.EDU (=?UTF-8?B?IkFsZWphbmRybyBSLiBTZWRl)
Wed Aug 4 12:39:45 2010

Date: Wed, 04 Aug 2010 12:39:42 -0400
From: =?UTF-8?B?IkFsZWphbmRybyBSLiBTZWRlw7FvIg==?= <asedeno@MIT.EDU>
To: Nelson Elhage <nelhage@mit.edu>
CC: barnowl-dev@mit.edu
In-Reply-To: <87wrs6pcgl.fsf@mit.edu>

On 08/04/2010 12:30 PM, Nelson Elhage wrote:
> I'm confused. Don't we only call that function from
> owl_zephyr_load_initial_subs, which is called from
> owl_zephyr_finish_initialization, which does
> owl_global_set_havezephyr(&g); immediately before the call?

No, we also call it from owl_function_loadsubs(), which can be called by
the user during startup. This dates back to owl. Honestly, that might be
an argument for removing that call site.

-Alejandro

> How can this get called when we don't have Zephyr initialized?
> 
> - Nelson
> 
> On Tue,  3 Aug 2010 18:04:17 -0400, Alejandro R. Sedeño <asedeno@MIT.EDU> wrote:
>> Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
>> ---
>>  zephyr.c |   10 ++++++----
>>  1 files changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/zephyr.c b/zephyr.c
>> index 4dead4a..8277c18 100644
>> --- a/zephyr.c
>> +++ b/zephyr.c
>> @@ -354,11 +354,13 @@ int owl_zephyr_loadbarnowldefaultsubs(void)
>>  int owl_zephyr_loaddefaultsubs(void)
>>  {
>>  #ifdef HAVE_LIBZEPHYR
>> -  ZSubscription_t subs[10];
>> +  if (owl_global_is_havezephyr(&g)) {
>> +    ZSubscription_t subs[10];
>>      
>> -  if (ZSubscribeTo(subs,0,0) != ZERR_NONE) {
>> -    owl_function_error("Error subscribing to default zephyr notifications.");
>> -    return(-1);
>> +    if (ZSubscribeTo(subs,0,0) != ZERR_NONE) {
>> +      owl_function_error("Error subscribing to default zephyr notifications.");
>> +      return(-1);
>> +    }
>>    }
>>    return(0);
>>  #else
>> -- 
>> 1.7.2.1
>>
>>
> 


home help back first fref pref prev next nref lref last post