|
From: <sv...@va...> - 2013-01-15 23:09:49
|
philippe 2013-01-15 23:09:41 +0000 (Tue, 15 Jan 2013)
New Revision: 13233
Log:
Improve error handling when vgdb cannot read process cmd line
Modified files:
trunk/coregrind/vgdb.c
Modified: trunk/coregrind/vgdb.c (+8 -2)
===================================================================
--- trunk/coregrind/vgdb.c 2013-01-15 03:31:26 +00:00 (rev 13232)
+++ trunk/coregrind/vgdb.c 2013-01-15 23:09:41 +00:00 (rev 13233)
@@ -2014,13 +2014,19 @@
if (fd == -1) {
DEBUG(1, "error opening cmdline file %s %s\n",
cmdline_file, strerror(errno));
- sprintf(cmdline, "(could not obtain process command line)");
+ sprintf(cmdline, "(could not open process command line)");
} else {
sz = read(fd, cmdline, 1000);
for (i = 0; i < sz; i++)
if (cmdline[i] == 0)
cmdline[i] = ' ';
- cmdline[sz] = 0;
+ if (sz >= 0)
+ cmdline[sz] = 0;
+ else {
+ DEBUG(1, "error reading cmdline file %s %s\n",
+ cmdline_file, strerror(errno));
+ sprintf(cmdline, "(could not read process command line)");
+ }
close (fd);
}
fprintf((on_stdout ? stdout : stderr), "use --pid=%d for %s\n", pid, cmdline);
|