Package: tmux / 2.3-4

upstream-1db6d6fea6.diff Patch series | download
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
commit 1db6d6fea6158d8d0d05e59497e40a5cfc40d068
Author: nicm <nicm>
Date:   Sun Oct 9 08:06:51 2016 +0000

    Pass file/line to new command for if-shell so that errors appear
    sensibly.

--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -50,6 +50,9 @@
 };
 
 struct cmd_if_shell_data {
+	char			*file;
+	u_int			 line;
+
 	char			*cmd_if;
 	char			*cmd_else;
 
@@ -106,7 +109,11 @@
 		return (CMD_RETURN_NORMAL);
 	}
 
-	cdata = xmalloc(sizeof *cdata);
+	cdata = xcalloc(1, sizeof *cdata);
+	if (self->file != NULL) {
+		cdata->file = xstrdup(self->file);
+		cdata->line = self->line;
+	}
 
 	cdata->cmd_if = xstrdup(args->argv[1]);
 	if (args->argc == 3)
@@ -148,7 +155,8 @@
 	if (cmd == NULL)
 		return;
 
-	if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
+	if (cmd_string_parse(cmd, &cmdlist, cdata->file, cdata->line,
+	    &cause) != 0) {
 		if (cause != NULL) {
 			cmdq_error(cmdq, "%s", cause);
 			free(cause);
@@ -184,6 +192,8 @@
 
 	free(cdata->cmd_else);
 	free(cdata->cmd_if);
+
+	free(cdata->file);
 	free(cdata);
 }
 
@@ -201,5 +211,7 @@
 
 	free(cdata->cmd_else);
 	free(cdata->cmd_if);
+
+	free(cdata->file);
 	free(cdata);
 }
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -97,7 +97,7 @@
 	shellcmd = format_expand(ft, args->argv[0]);
 	format_free(ft);
 
-	cdata = xmalloc(sizeof *cdata);
+	cdata = xcalloc(1, sizeof *cdata);
 	cdata->cmd = shellcmd;
 	cdata->bflag = args_has(args, 'b');
 	cdata->wp_id = wp != NULL ? (int) wp->id : -1;