Author: sandervanderburg
Date: Mon Aug 2 15:10:15 2010
New Revision: 22877
URL: https://svn.nixos.org/websvn/nix/?rev=22877&sc=1
Log:
Added an additional check to give better error messages and added NULL
termination to the arguments vector
Modified:
disnix/disnix/trunk/src/dbus-service/disnix-client.c
Modified: disnix/disnix/trunk/src/dbus-service/disnix-client.c
==============================================================================
--- disnix/disnix/trunk/src/dbus-service/disnix-client.c Mon Aug 2
13:57:57 2010 (r22876)
+++ disnix/disnix/trunk/src/dbus-service/disnix-client.c Mon Aug 2
15:10:15 2010 (r22877)
@@ -207,7 +207,15 @@
switch(operation)
{
case OP_IMPORT:
- org_nixos_disnix_Disnix_import(remote_object, pid, derivation[0],
&error);
+ if(derivation[0] == NULL)
+ {
+ g_printerr("ERROR: A Nix store component has to be
specified!\n");
+ g_strfreev(derivation);
+ g_strfreev(arguments);
+ return 1;
+ }
+ else
+ org_nixos_disnix_Disnix_import(remote_object, pid,
derivation[0], &error);
break;
case OP_EXPORT:
org_nixos_disnix_Disnix_export(remote_object, pid, (const gchar**)
derivation, &error);
@@ -238,6 +246,13 @@
g_strfreev(arguments);
return 1;
}
+ else if(derivation[0] == NULL)
+ {
+ g_printerr("ERROR: A Nix store component has to 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;
@@ -249,6 +264,13 @@
g_strfreev(arguments);
return 1;
}
+ else if(derivation[0] == NULL)
+ {
+ g_printerr("ERROR: A Nix store component has to 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;
@@ -409,6 +431,10 @@
derivation = g_realloc(derivation, (derivation_size + 1) * sizeof(gchar*));
derivation[derivation_size] = NULL;
+ /* Add NULL termination to the arguments vector */
+ arguments = g_realloc(arguments, (arguments_size + 1) * sizeof(gchar*));
+ arguments[arguments_size] = NULL;
+
/* Execute Disnix client */
return run_disnix_client(operation, derivation, session_bus, profile,
delete_old, arguments, type);
}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits