1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
2002-08-08  Ulrich Drepper  <drepper@redhat.com>

	* gmon/gmon.c (write_gmon): Use O_NOFOLLOW in open calls if available.
This commit is contained in:
Ulrich Drepper
2002-08-08 09:04:02 +00:00
parent 48b8e8464b
commit b7eb7b0f6d
4 changed files with 14 additions and 10 deletions

View File

@@ -320,18 +320,22 @@ write_gmon (void)
int fd = -1;
char *env;
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
env = getenv ("GMON_OUT_PREFIX");
if (env != NULL && !__libc_enable_secure)
{
size_t len = strlen (env);
char buf[len + 20];
sprintf (buf, "%s.%u", env, __getpid ());
fd = __open (buf, O_CREAT|O_TRUNC|O_WRONLY, 0666);
fd = __open (buf, O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW, 0666);
}
if (fd == -1)
{
fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW, 0666);
if (fd < 0)
{
char buf[300];