hal/tools fstab-sync.c,1.25,1.26

David Zeuthen david at freedesktop.org
Mon Oct 18 17:17:52 PDT 2004


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv19775/tools

Modified Files:
	fstab-sync.c 
Log Message:
2004-10-18  David Zeuthen  <davidz at redhat.com>

	* tools/fstab-sync.c (main): Fix crasher when no options are given



Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- fstab-sync.c	15 Oct 2004 20:53:45 -0000	1.25
+++ fstab-sync.c	19 Oct 2004 00:17:50 -0000	1.26
@@ -1653,27 +1653,23 @@
   openlog (PROGRAM_NAME, LOG_PID, LOG_USER);
   
   struct poptOption options[] = {
-      {"add", 'a', POPT_ARG_STRING, &udi_to_add, 0,
-        N_("add an entry to fstab"), N_("UDI")},
-      {"remove", 'r', POPT_ARG_STRING, &udi_to_remove, 0,
-        N_("remove an entry from fstab"), N_("UDI")},
-      {"clean", 'c', POPT_ARG_NONE, &should_clean, 0,
-        N_("Remove all generated entries from fstab")},
-      {"verbose", 'v', POPT_ARG_NONE, &verbose, 0,
-        N_("Report detailed information about operation progress")},
+      {"add",     'a', POPT_ARG_STRING, &udi_to_add,    0, N_("add an entry to fstab"), N_("UDI")},
+      {"remove",  'r', POPT_ARG_STRING, &udi_to_remove, 0, N_("remove an entry from fstab"), N_("UDI")},
+      {"clean",   'c', POPT_ARG_NONE,   &should_clean,  0, N_("Remove all generated entries from fstab"), NULL},
+      {"verbose", 'v', POPT_ARG_NONE,   &verbose,       0, N_("Report detailed information about operation progress"), NULL},
 
       POPT_AUTOHELP
 
-      {NULL, '\0', 0, NULL},
+      {NULL, '\0', 0, NULL, 0, NULL, NULL}
   };
 
   popt_context = poptGetContext (PROGRAM_NAME, argc, argv, options, 0);
-
+	  
   while ((i = poptGetNextOpt (popt_context)) != -1)
     {
       if (i < -1)
         {
-          poptPrintHelp (popt_context, stderr, 0);
+	  poptPrintHelp (popt_context, stderr, 0);
           return 1;
         }
     }
@@ -1760,7 +1756,6 @@
 			  break;
 		  }
 	  }
-  poptFreeContext (popt_context);
 
   hal_context = hal_initialize (NULL, FALSE);
   fsy_mount_root = hal_drive_policy_default_get_mount_root (hal_context);
@@ -1792,8 +1787,8 @@
     retval = clean ();
   else
     {
-      poptPrintHelp (popt_context, stderr, 0);
-      return 1;
+	poptPrintHelp (popt_context, stderr, 0);
+	return 1;
     }
 
   if (hal_device_udi != NULL) {
@@ -1816,6 +1811,8 @@
     fstab_update_debug (_("\n"));
   }
 
+  poptFreeContext (popt_context);
+
 out:
   return retval;
 }




More information about the hal-commit mailing list