[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

PATCH:Fix [only allows one param]



Hi,

I made the patch which fixes [only allows one param]
Would you review the attached patch, please?

thank you
diff -u -r1.14 modstubs.c
--- loader2/modstubs.c  27 Jul 2006 22:35:18 -0000      1.14
+++ loader2/modstubs.c  5 Jul 2007 12:17:20 -0000
@@ -88,6 +88,8 @@
     int fd;
     void * modbuf = NULL;
     struct stat sb;
+    int i;
+    char *options = strdup("");

     if (argc < 2) {
         return usage();
@@ -138,12 +140,14 @@
         return 1;
     }

-    if (argc > 2) {
-        /* FIXME: only allows one param */
-        rc = init_module(modbuf, sb.st_size, argv[2]);
-    } else {
-        rc = init_module(modbuf, sb.st_size, "");
-    }
+    for (i = 2; i < argc; i++) {
+        options = realloc(options,
+                          strlen(options) + 1 + strlen(argv[i]) + 1);
+        strcat(options, argv[i]);
+        strcat(options, " ");
+     }
+
+    rc = init_module(modbuf, sb.st_size, options);
     if (rc != 0)
         logMessage(WARNING, "failed to insert module (%d)", errno);
     return rc;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]