Parcourir la source

Fix clish_script return values

Serj Kalichev il y a 11 ans
Parent
commit
9d92e4adda
1 fichiers modifiés avec 10 ajouts et 10 suppressions
  1. 10 10
      plugins/default/sym_script.c

+ 10 - 10
plugins/default/sym_script.c

@@ -41,7 +41,7 @@ CLISH_PLUGIN_SYM(clish_script)
 
 	assert(this);
 	if (!script) /* Nothing to do */
-		return BOOL_TRUE;
+		return 0;
 
 	/* Find out shebang */
 	if (action)
@@ -62,17 +62,17 @@ CLISH_PLUGIN_SYM(clish_script)
 		/* Get FIFO */
 		fifo_name = clish_shell__get_fifo(this);
 		if (!fifo_name) {
-			fprintf(stderr, "System error. Can't create temporary FIFO.\n"
-				"The ACTION will be not executed.\n");
-			return BOOL_FALSE;
+			fprintf(stderr, "Error: Can't create temporary FIFO.\n"
+				"Error: The ACTION will be not executed.\n");
+			return -1;
 		}
 
 		/* Create process to write to FIFO */
 		cpid = fork();
 		if (cpid == -1) {
-			fprintf(stderr, "System error. Can't fork the write process.\n"
-				"The ACTION will be not executed.\n");
-			return BOOL_FALSE;
+			fprintf(stderr, "Error: Can't fork the write process.\n"
+				"Error: The ACTION will be not executed.\n");
+			return -1;
 		}
 
 		/* Child: write to FIFO */
@@ -111,8 +111,8 @@ CLISH_PLUGIN_SYM(clish_script)
 		/* Execute shebang with FIFO as argument */
 		rpipe = popen(command, "r");
 		if (!rpipe) {
-			fprintf(stderr, "System error. Can't fork the script.\n"
-				"The ACTION will be not executed.\n");
+			fprintf(stderr, "Error: Can't fork the script.\n"
+				"Error: The ACTION will be not executed.\n");
 			lub_string_free(command);
 			if (!is_sh) {
 				kill(cpid, SIGTERM);
@@ -123,7 +123,7 @@ CLISH_PLUGIN_SYM(clish_script)
 			sigaction(SIGINT, &sig_old_int, NULL);
 			sigaction(SIGQUIT, &sig_old_quit, NULL);
 
-			return BOOL_FALSE;
+			return -1;
 		}
 		/* Read the result of script execution */
 		buf = konf_buf_new(fileno(rpipe));