diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2014-12-15 09:10:41 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2014-12-15 09:10:41 +0100 |
commit | 451f11993580c3fb0b80da62885a00f8ee265304 (patch) | |
tree | 67e523c86d557fad96ecc174028975ceba2f2c61 /fixincludes | |
parent | dea91a66ff51bb0f37db48baebc7e098947713e9 (diff) | |
download | gcc-451f11993580c3fb0b80da62885a00f8ee265304.tar.gz |
server.c (server_setup): Check return value of getcwd and in case of error set buff[0] to 0.
* server.c (server_setup): Check return value of
getcwd and in case of error set buff[0] to 0.
From-SVN: r218732
Diffstat (limited to 'fixincludes')
-rw-r--r-- | fixincludes/ChangeLog | 5 | ||||
-rw-r--r-- | fixincludes/server.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 54945b50a89..571b6d17f60 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,8 @@ +2014-12-15 Uros Bizjak <ubizjak@gmail.com> + + * server.c (server_setup): Check return value of + getcwd and in case of error set buff[0] to 0. + 2014-10-21 Uros Bizjak <ubizjak@gmail.com> * inclhack.def (glibc_c99_inline_4): Add pthread.h to files. diff --git a/fixincludes/server.c b/fixincludes/server.c index 1e50efc9faa..f1b93a0c388 100644 --- a/fixincludes/server.c +++ b/fixincludes/server.c @@ -192,7 +192,8 @@ server_setup (void) fputs ("trap : 1\n", server_pair.pf_write); fflush (server_pair.pf_write); - getcwd (buff, MAXPATHLEN + 1); + if (getcwd (buff, MAXPATHLEN + 1) == NULL) + buff[0] = 0; p_cur_dir = xstrdup (buff); } |