Author: sandervanderburg
Date: 2010-06-10 13:24:31 +0000 (Thu, 10 Jun 2010)
New Revision: 22212

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22212&view=rev

Modified:
   disnix/disnix/trunk/src/dbus-service/disnix-client.c

Log:
Implemented a check for activation type to prevent a segfault

Changes:

Modified: disnix/disnix/trunk/src/dbus-service/disnix-client.c
===================================================================
--- disnix/disnix/trunk/src/dbus-service/disnix-client.c        2010-06-10 
12:47:58 UTC (rev 22211)
+++ disnix/disnix/trunk/src/dbus-service/disnix-client.c        2010-06-10 
13:24:31 UTC (rev 22212)
@@ -231,10 +231,26 @@
            org_nixos_disnix_Disnix_collect_garbage(remote_object, pid, 
delete_old, &error);
            break;
        case OP_ACTIVATE:
-           org_nixos_disnix_Disnix_activate(remote_object, pid, derivation[0], 
type, (const gchar**) arguments, &error);
+           if(type == NULL)
+           {
+               g_printerr("ERROR: A type must be specified!\n");
+               g_strfreev(derivation);
+               g_strfreev(arguments);
+               return 1;
+           }
+           else
+               org_nixos_disnix_Disnix_activate(remote_object, pid, 
derivation[0], type, (const gchar**) arguments, &error);
            break;
        case OP_DEACTIVATE:
-           org_nixos_disnix_Disnix_deactivate(remote_object, pid, 
derivation[0], type, (const gchar**) arguments, &error);
+           if(type == NULL)
+           {
+               g_printerr("ERROR: A type must be specified!\n");
+               g_strfreev(derivation);
+               g_strfreev(arguments);
+               return 1;
+           }
+           else
+               org_nixos_disnix_Disnix_deactivate(remote_object, pid, 
derivation[0], type, (const gchar**) arguments, &error);
            break;
        case OP_LOCK:
            org_nixos_disnix_Disnix_lock(remote_object, pid, profile, &error);
@@ -300,7 +316,7 @@
 
     /* Option value declarations */
     Operation operation = OP_NONE;
-    char *target, *profile = "default", *type;
+    char *target, *profile = "default", *type = NULL;
     gchar **derivation = NULL, **arguments = NULL;
     unsigned int derivation_size = 0, arguments_size = 0;
     int localfile = FALSE, remotefile = TRUE;

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to