[PATCH] Balsa crash on first start when no $MAIL in environment



Hi,

 Here is a small patch against cvs to handle the case of no environment
variable 'MAIL'. It would cause balsa to crash on first start (no '.balsarc')
because it passes a NULL pointer to balsa_init_add_table_entry.

 The fix create a default value for the Inbox as '/var/spool/mail/myusername'
by looking at the environment variable 'USER' and if don't exist it passes
a empty string instead of a NULL pointer.

 As I'm new here, I don't know much of the usage and coding standard, so feel
free to correct me.

Cheers,


			Odie


*** balsa-druid-page-directory.c.orig   Mon May  1 20:51:24 2000
--- balsa-druid-page-directory.c        Mon May  1 20:51:52 2000
***************
*** 219,224 ****
--- 219,231 ----
                preset = getenv( "MAIL" );
                if( preset )
                        preset = g_strdup( preset );
+               else {
+                       preset = getenv( "USER" );
+                       if( preset )
+                               preset = g_strdup_printf( "/var/spool/mail/%s", preset );
+                       else
+                               preset = "";
+               }
                balsa_init_add_table_entry( table, 0, _("Inbox:"), preset, 
                        &( self->_priv->ed0 ), GTK_WIDGET( self ), &( self->_priv->inbox ) );
                if( preset )

-- 
-----------------------------------------------------
Olivier Dormond aka Odie (olivier.dormond@urbanet.ch)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]