[Pommed-commits] r287 - trunk/gpomme

Julien Blache jblache at alioth.debian.org
Thu Mar 1 22:30:10 CET 2007


Author: jblache
Date: 2007-03-01 22:30:09 +0100 (Thu, 01 Mar 2007)
New Revision: 287

Modified:
   trunk/gpomme/conffile.c
Log:
Create the config file if it doesn't exist.


Modified: trunk/gpomme/conffile.c
===================================================================
--- trunk/gpomme/conffile.c	2007-03-01 14:05:31 UTC (rev 286)
+++ trunk/gpomme/conffile.c	2007-03-01 21:30:09 UTC (rev 287)
@@ -120,13 +120,20 @@
    * we'll be using the default values defined in the cfg_opt_t array.
    */
   ret = cfg_parse(cfg, conffile);
-  if ((ret != CFG_SUCCESS) && (ret != CFG_FILE_ERROR))
+  if (ret != CFG_SUCCESS)
     {
-      cfg_free(cfg);
+      if (ret == CFG_FILE_ERROR)
+	{
+	  config_write();
+	}
+      else
+	{
+	  cfg_free(cfg);
 
-      fprintf(stderr, "Failed to parse configuration file\n");
+	  fprintf(stderr, "Failed to parse configuration file\n");
 
-      return -1;
+	  return -1;
+	}
     }
 
   /* Fill up the structs */




More information about the Pommed-commits mailing list