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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
http://patches.ubuntu.com/g/gdb/extracted/gcc-4.3-build-error.patch
--- gdb/cli/cli-cmds.c~ 2008-06-24 16:07:25.000000000 +0200
+++ gdb/cli/cli-cmds.c 2008-06-24 16:22:31.000000000 +0200
@@ -323,7 +323,8 @@
{
if (args)
error (_("The \"pwd\" command does not take an argument: %s"), args);
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ if (!getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ error (_("Unable to determine current directory"));
if (strcmp (gdb_dirbuf, current_directory) != 0)
printf_unfiltered (_("Working directory %s\n (canonically %s).\n"),
--- gdb/linux-nat.c~ 2008-01-29 23:47:20.000000000 +0100
+++ gdb/linux-nat.c 2008-06-24 16:18:57.000000000 +0200
@@ -2876,7 +2876,8 @@
sprintf (fname1, "/proc/%lld/cmdline", pid);
if ((procfile = fopen (fname1, "r")) != NULL)
{
- fgets (buffer, sizeof (buffer), procfile);
+ if (!fgets (buffer, sizeof (buffer), procfile))
+ error(_("Unable to read '%s'"), fname1);
printf_filtered ("cmdline = '%s'\n", buffer);
fclose (procfile);
}
--- gdb/inflow.c~ 2008-01-01 23:53:11.000000000 +0100
+++ gdb/inflow.c 2008-06-24 16:32:10.000000000 +0200
@@ -512,7 +512,7 @@
void
new_tty (void)
{
- int tty;
+ int tty, rv;
if (inferior_thisrun_terminal == 0)
return;
@@ -545,17 +545,17 @@
if (tty != 0)
{
close (0);
- dup (tty);
+ rv = dup (tty);
}
if (tty != 1)
{
close (1);
- dup (tty);
+ rv = dup (tty);
}
if (tty != 2)
{
close (2);
- dup (tty);
+ rv = dup (tty);
}
if (tty > 2)
close (tty);
--- gdb/mi/mi-cmd-env.c~ 2008-01-01 23:53:14.000000000 +0100
+++ gdb/mi/mi-cmd-env.c 2008-06-24 16:23:25.000000000 +0200
@@ -78,7 +78,8 @@
/* Otherwise the mi level is 2 or higher. */
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ if (!getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ error (_("Unable to determine current directory"));
ui_out_field_string (uiout, "cwd", gdb_dirbuf);
return MI_CMD_DONE;
--- gdb/utils.c~ 2008-01-01 23:53:13.000000000 +0100
+++ gdb/utils.c 2008-06-24 16:29:13.000000000 +0200
@@ -688,6 +688,7 @@
static int dejavu;
int quit_p;
int dump_core_p;
+ int rv;
char *reason;
/* Don't allow infinite error/warning recursion. */
@@ -704,7 +705,7 @@
abort (); /* NOTE: GDB has only three calls to abort(). */
default:
dejavu = 3;
- write (STDERR_FILENO, msg, sizeof (msg));
+ rv = write (STDERR_FILENO, msg, sizeof (msg));
exit (1);
}
}
--- gdb/top.c~ 2008-01-01 23:53:13.000000000 +0100
+++ gdb/top.c 2008-06-24 16:26:51.000000000 +0200
@@ -1628,7 +1628,8 @@
/* Run the init function of each source file */
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ if (!getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ error (_("Unable to determine current directory"));
current_directory = gdb_dirbuf;
#ifdef __MSDOS__
--- gdb/ui-file.c~ 2008-01-01 23:53:13.000000000 +0100
+++ gdb/ui-file.c 2008-06-24 16:30:16.000000000 +0200
@@ -477,11 +477,12 @@
static void
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
{
+ int rv;
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_write: bad magic number"));
- fwrite (buf, length_buf, 1, stdio->file);
+ rv = fwrite (buf, length_buf, 1, stdio->file);
}
static void
--- gdb/main.c~ 2008-06-24 16:07:25.000000000 +0200
+++ gdb/main.c 2008-06-24 16:25:05.000000000 +0200
@@ -188,7 +188,8 @@
line[0] = '\0'; /* Terminate saved (now empty) cmd line */
instream = stdin;
- getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+ if (!getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ error (_("Unable to determine current directory"));
current_directory = gdb_dirbuf;
gdb_stdout = stdio_fileopen (stdout);
|