File: warnings.patch

package info (click to toggle)
mdk 1.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,016 kB
  • sloc: ansic: 22,682; sh: 6,167; lisp: 1,118; lex: 830; makefile: 582; yacc: 288; python: 124
file content (81 lines) | stat: -rw-r--r-- 2,078 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Description: Fix a couple of compiler warnings.
 Add a %s to a couple of printf statements.
 Do not ignore the system() return value.
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2015-09-15

--- a/mixlib/testsuite/mix_parser_t.c
+++ b/mixlib/testsuite/mix_parser_t.c
@@ -51,7 +51,7 @@
 
   if (err != MIX_PERR_OK)
     {
-      g_print (mix_parser_err_string (err));
+      g_print ("%s", mix_parser_err_string (err));
       g_print ("\n");
     }
 
--- a/mixlib/xmix_vm_handlers.c
+++ b/mixlib/xmix_vm_handlers.c
@@ -249,6 +249,8 @@
 gboolean
 cmd_edit_ (mix_vm_cmd_dispatcher_t *dis, const gchar *arg)
 {
+  int r;
+
   if (dis->editor == NULL)
     {
       log_error_ (dis, _("Editor not specified (use sedit)"));
@@ -264,8 +266,16 @@
     {
       gchar *cmd = g_strdup_printf (dis->editor, arg);
       if (wants_logs_ (dis)) log_message_ (dis, cmd);
-      system (cmd);
-      if (wants_logs_ (dis)) log_message_ (dis, _(" ...done"));
+      r = system (cmd);
+      if (r < 0)
+	log_error_ (dis, _("Could not invoke the editor command '%s': %s"), cmd, strerror(errno));
+      else if (wants_logs_ (dis))
+	{
+	  if (r != 0)
+	    log_message_ (dis, _(" ...system() returned %d"), r);
+	  else
+	    log_message_ (dis, _(" ...done"));
+	}
       g_free (cmd);
       return TRUE;
     }
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -21,6 +21,10 @@
 
 #include <mixlib/mix.h>
 
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -172,7 +176,18 @@
 static int
 cmd_shell_ (mix_vm_cmd_dispatcher_t *dis, const char *arg)
 {
-  system (arg);
+  int r;
+
+  r = system (arg);
+  if (r < 0)
+    fprintf (stderr, "Could not fork for %s: %s", arg, strerror(errno));
+  else if (r != 0)
+    {
+      if (WIFEXITED(r))
+	fprintf (stderr, "The command '%s' exited with code %d\n", arg, WEXITSTATUS(r));
+      else if (WIFSIGNALED(r))
+	fprintf (stderr, "The command '%s' was terminated by signal %d\n", arg, WTERMSIG(r));
+    }
   return TRUE;
 }