SF.net SVN: geany-plugins:[1403] trunk/geany-plugins/geanygendoc/src/ ggd-utils.c

colombanw at users.sourceforge.net colombanw at xxxxx
Sun May 23 22:36:53 UTC 2010


Revision: 1403
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1403&view=rev
Author:   colombanw
Date:     2010-05-23 22:36:52 +0000 (Sun, 23 May 2010)

Log Message:
-----------
GeanyGenDoc: Fix error reporting in ggd_get_config_file()

Don't report an error in the GError if there is actually no error,
which may lead the caller not to handle this correctly, or to corrupt
its other uses of the passed error.

Modified Paths:
--------------
    trunk/geany-plugins/geanygendoc/src/ggd-utils.c

Modified: trunk/geany-plugins/geanygendoc/src/ggd-utils.c
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd-utils.c	2010-05-23 21:33:20 UTC (rev 1402)
+++ trunk/geany-plugins/geanygendoc/src/ggd-utils.c	2010-05-23 22:36:52 UTC (rev 1403)
@@ -198,10 +198,11 @@
         
         /* try to copy the system file to the user's configuration directory */
         if (ggd_copy_file (system_path, user_path, TRUE, 0640, &gerr) ||
-            /* the file was already exist (unlikely if GGD_PERMS_R is set) */
+            /* the file already exists (unlikely if GGD_PERMS_R is set) */
             gerr->code == G_FILE_ERROR_EXIST) {
           path = user_path;
           if (gerr) g_clear_error (&gerr);
+          g_clear_error (error);
         } else if (gerr->code == G_FILE_ERROR_NOENT) {
           /* the system file doesn't exist. No problem, just try to create the
            * file (if it does not already exist) */
@@ -214,6 +215,7 @@
           } else {
             close (fd);
             path = user_path;
+            g_clear_error (error);
           }
         }
         if (gerr) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list