diff options
author | Jim Blandy <jimb@codesourcery.com> | 2009-01-06 18:31:59 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2009-01-06 18:31:59 +0000 |
commit | bf1d7d9ce0e35cfa01400e2da11f0d84ea89e481 (patch) | |
tree | 14141ae5495ade474ca69afa2dbe85a60e302989 /gdb/main.c | |
parent | fdb7262ae487eccebfaf84f3a5cbecbdeae2c5c7 (diff) | |
download | gdb-bf1d7d9ce0e35cfa01400e2da11f0d84ea89e481.zip gdb-bf1d7d9ce0e35cfa01400e2da11f0d84ea89e481.tar.gz gdb-bf1d7d9ce0e35cfa01400e2da11f0d84ea89e481.tar.bz2 |
Check return values of functions declared with warn_unused_result
attribute in GLIBC 2.8.
* cli/cli-cmds.c (pwd_command): Check return value from getcwd.
* inflow.c (check_syscall): New function.
(new_tty): Use check_syscall to check return values from open and dup.
* linux-nat.c (linux_nat_info_proc_cmd): Check return value from fgets.
* main.c (captured_main): Call cwd after setting up gdb_stderr;
check for errors from getcwd.
* mi/mi-cmd-env.c (mi_cmd_env_pwd): Check return value from getcwd.
* ui-file.c (stdio_file_write): Ignore return value from fwrite.
(stdio_file_fputs): Same.
* utils.c (internal_vproblem): abort if last-ditch error message
write fails.
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -188,9 +188,6 @@ captured_main (void *data) line[0] = '\0'; /* Terminate saved (now empty) cmd line */ instream = stdin; - getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - current_directory = gdb_dirbuf; - gdb_stdout = stdio_fileopen (stdout); gdb_stderr = stdio_fileopen (stderr); gdb_stdlog = gdb_stderr; /* for moment */ @@ -199,6 +196,15 @@ captured_main (void *data) gdb_stdtargerr = gdb_stderr; /* for moment */ gdb_stdtargin = gdb_stdin; /* for moment */ + if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) + /* Don't use *_filtered or warning() (which relies on + current_target) until after initialize_all_files(). */ + fprintf_unfiltered (gdb_stderr, + _("%s: warning: error finding working directory: %s\n"), + argv[0], safe_strerror (errno)); + + current_directory = gdb_dirbuf; + /* Set the sysroot path. */ #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT); |