Alexandre Julliard : winemenubuilder: Use spawnvp() instead of system() to launch the xdg update scripts.

Alexandre Julliard julliard at winehq.org
Tue Jun 30 08:33:33 CDT 2009


Module: wine
Branch: master
Commit: afe626fb9972d612fd84a8a76eae6ef12f503465
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=afe626fb9972d612fd84a8a76eae6ef12f503465

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 30 14:27:35 2009 +0200

winemenubuilder: Use spawnvp() instead of system() to launch the xdg update scripts.

---

 programs/winemenubuilder/winemenubuilder.c |   31 ++++++++-------------------
 1 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 27a9e5e..200cd0f 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -2525,29 +2525,16 @@ static void RefreshFileTypeAssociations(void)
     hasChanged |= cleanup_associations();
     if (hasChanged)
     {
-        char *command = heap_printf("update-mime-database %s", mime_dir);
-        if (command)
-        {
-            system(command);
-            HeapFree(GetProcessHeap(), 0, command);
-        }
-        else
-        {
-            WINE_ERR("out of memory\n");
-            goto end;
-        }
+        const char *argv[3];
 
-        command = heap_printf("update-desktop-database %s/applications", xdg_data_dir);
-        if (command)
-        {
-            system(command);
-            HeapFree(GetProcessHeap(), 0, command);
-        }
-        else
-        {
-            WINE_ERR("out of memory\n");
-            goto end;
-        }
+        argv[0] = "update-mime-database";
+        argv[1] = mime_dir;
+        argv[2] = NULL;
+        spawnvp( _P_NOWAIT, argv[0], argv );
+
+        argv[0] = "update-desktop-database";
+        argv[1] = applications_dir;
+        spawnvp( _P_NOWAIT, argv[0], argv );
     }
 
 end:




More information about the wine-cvs mailing list