Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
2000-08-31  Ulrich Drepper  <drepper@redhat.com>

	* malloc/malloc.c (ptmalloc_init): Optimize a bit by not calling
	__secure_getenv.  Instead test __libc_enable_secure once.

	* io/pwd.c (main): Provide a good example, use *_unlocked function.
  • Loading branch information
Ulrich Drepper committed Aug 31, 2000
1 parent b2fe29d commit fbcc099
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2000-08-31 Ulrich Drepper <drepper@redhat.com>

* malloc/malloc.c (ptmalloc_init): Optimize a bit by not calling
__secure_getenv. Instead test __libc_enable_secure once.

* io/pwd.c (main): Provide a good example, use *_unlocked function.

2000-08-30 Ulrich Drepper <drepper@redhat.com>

* iconv/gconv_conf.c (insert_module): Take extra parameter to decide
Expand Down
4 changes: 2 additions & 2 deletions io/pwd.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -35,7 +35,7 @@ main (void)
perror ("getcwd");
else
{
puts (dir);
fputs_unlocked (dir, stdout);
free (dir);
}

Expand Down
29 changes: 15 additions & 14 deletions malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@ extern char* getenv();
# endif
#endif

#ifndef _LIBC
# define __secure_getenv(Str) getenv (Str)
#endif

/* Macros for handling mutexes and thread-specific data. This is
included early, because some thread-related header files (such as
pthread.h) should be included before any others. */
Expand Down Expand Up @@ -1680,6 +1676,7 @@ ptmalloc_init __MALLOC_P((void))
char* s;
# endif
#endif
int secure;

if(__malloc_initialized >= 0) return;
__malloc_initialized = 0;
Expand Down Expand Up @@ -1708,20 +1705,24 @@ ptmalloc_init __MALLOC_P((void))
tsd_setspecific(arena_key, (Void_t *)&main_arena);
thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);
#if defined _LIBC || defined MALLOC_HOOKS
if((s = __secure_getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = __secure_getenv("MALLOC_TOP_PAD_")))
mALLOPt(M_TOP_PAD, atoi(s));
if((s = __secure_getenv("MALLOC_MMAP_THRESHOLD_")))
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
if((s = __secure_getenv("MALLOC_MMAP_MAX_")))
mALLOPt(M_MMAP_MAX, atoi(s));
s = getenv("MALLOC_CHECK_");
#ifndef NO_THREADS
__malloc_hook = save_malloc_hook;
__free_hook = save_free_hook;
#endif
if(s && (! __libc_enable_secure || access ("/etc/suid-debug", F_OK) == 0)) {
secure = __libc_enable_secure;
if (! secure)
{
if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_TOP_PAD_")))
mALLOPt(M_TOP_PAD, atoi(s));
if((s = getenv("MALLOC_MMAP_THRESHOLD_")))
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_MMAP_MAX_")))
mALLOPt(M_MMAP_MAX, atoi(s));
}
s = getenv("MALLOC_CHECK_");
if(s && (! secure || access ("/etc/suid-debug", F_OK) == 0)) {
if(s[0]) mALLOPt(M_CHECK_ACTION, (int)(s[0] - '0'));
__malloc_check_init();
}
Expand Down

0 comments on commit fbcc099

Please sign in to comment.