summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-09-01 12:25:01 -0600
committerEric Blake <ebb9@byu.net>2009-09-02 20:33:22 -0600
commitfc333501ca97880108c8ff17e33d9dd7d5e28ed4 (patch)
tree07c376828675d6e9d737cf1e5bbc1e4345eb23e6 /lib/getcwd.c
parent02fd4eb4561842dee666b709fbbb1632c4357d2d (diff)
downloadgnulib-fc333501ca97880108c8ff17e33d9dd7d5e28ed4.tar.gz
backupfile, chdir-long, fts, savedir: make safer
* lib/backupfile.c (includes): Use "dirent--.h", since numbered_backup can write to stderr during readdir. * lib/savedir.c (includes): Likewise. * lib/chdir-long.c (includes): Use "fcntl--.h", since openat emulation can write to stderr on failure. * lib/fts.c (includes) [!_LIBC]: Likewise for opendir and openat. * lib/getcwd.c: Document why opendir_safer is unused. * lib/glob.c: Likewise. * lib/scandir.c: Likewise. * lib/openat-proc.c: Likewise, for open_safer. * modules/backupfile (Depends-on): Add dirent-safer. * modules/savedir (Depends-on): Likewise. * modules/fts (Depends-on): Add dirent-safer and openat-safer. * modules/chdir-long (Depends-on): Add openat-safer. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index b9e57d31a9..2da1aeef28 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2004-2008 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2004-2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -103,7 +103,11 @@
#endif
/* The results of opendir() in this file are not used with dirfd and fchdir,
- therefore save some unnecessary recursion in fchdir.c. */
+ and we do not leak fds to any single-threaded code that could use stdio,
+ therefore save some unnecessary recursion in fchdir.c.
+ FIXME - if the kernel ever adds support for multi-thread safety for
+ avoiding standard fds, then we should use opendir_safer and
+ openat_safer. */
#undef opendir
#undef closedir