Просмотр исходного кода

ncd/modules/runonce.c: support non-ContinuousString strings

ambrop7 13 лет назад
Родитель
Сommit
f4713318cf
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      ncd/modules/runonce.c

+ 5 - 3
ncd/modules/runonce.c

@@ -123,8 +123,9 @@ static int build_cmdline (NCDModuleInst *i, NCDValRef cmd_arg, char **exec, CmdL
             goto fail2;
         }
         
-        if (!CmdLine_AppendNoNull(cl, NCDVal_StringData(arg), NCDVal_StringLength(arg))) {
-            ModuleLog(i, BLOG_ERROR, "CmdLine_AppendNoNull failed");
+        b_cstring arg_cstr = NCDVal_StringCstring(arg);
+        if (!CmdLine_AppendCstring(cl, arg_cstr, 0, arg_cstr.length)) {
+            ModuleLog(i, BLOG_ERROR, "CmdLine_AppendCstring failed");
             goto fail2;
         }
     }
@@ -313,7 +314,8 @@ static struct NCDModule modules[] = {
         .func_new2 = func_new,
         .func_die = func_die,
         .func_getvar = func_getvar,
-        .alloc_size = sizeof(struct instance)
+        .alloc_size = sizeof(struct instance),
+        .flags = NCDMODULE_FLAG_ACCEPT_NON_CONTINUOUS_STRINGS
     }, {
         .type = NULL
     }