>>>>> On Thu, 06 Jul 2006 09:53:57 +0900, YAMAMOTO Mitsuharu <[EMAIL >>>>> PROTECTED]> said:
> I've once posted a (not complete) list of Darwin library functions > that may call malloc-related functions but are not protected by > BLOCK_INPUT: > localtime, gmtime, ctime, opendir, getc, getaddrinfo, fwrite, > mkstemp fclose, closedir, freeaddrinfo, mktime (not used as of > 2004-09) > (http://lists.gnu.org/archive/html/emacs-devel/2004-09/msg00074.html) > I cannot detect `getgrgid' as such a function, but I guess this is > due to the difference in name service backends (NIS, LDAP, ...). Sorry, I could. So it has nothing to do with the type of backends. Also, I found that getpwuid/getpwnam/getgrgid in both glibc and FreeBSD libc called malloc-related functions. So I think it's reasonable to put BLOCK_INPUTs around them. Objections? YAMAMOTO Mitsuharu [EMAIL PROTECTED] Index: src/Makefile.in =================================================================== RCS file: /cvsroot/emacs/emacs/src/Makefile.in,v retrieving revision 1.327 diff -c -p -r1.327 Makefile.in *** src/Makefile.in 18 May 2006 17:05:36 -0000 1.327 --- src/Makefile.in 8 Jul 2006 05:30:06 -0000 *************** pre-crt0.o: pre-crt0.c *** 1108,1114 **** ecrt0.o: ecrt0.c $(config_h) CRT0_COMPILE ${srcdir}/ecrt0.c dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \ ! systime.h dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \ window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ disptab.h indent.h intervals.h \ --- 1108,1114 ---- ecrt0.o: ecrt0.c $(config_h) CRT0_COMPILE ${srcdir}/ecrt0.c dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \ ! systime.h blockinput.h dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \ window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ disptab.h indent.h intervals.h \ *************** doprnt.o: doprnt.c charset.h $(config_h) *** 1119,1130 **** dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h) editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ ! coding.h dispextern.h frame.h $(config_h) emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ window.h dispextern.h keyboard.h keymap.h fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ ! coding.h msdos.h dispextern.h $(config_h) filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h) filemode.o: filemode.c $(config_h) frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ --- 1119,1130 ---- dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h) editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ ! coding.h dispextern.h frame.h blockinput.h $(config_h) emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ window.h dispextern.h keyboard.h keymap.h fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ ! coding.h msdos.h dispextern.h blockinput.h $(config_h) filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h) filemode.o: filemode.c $(config_h) frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ Index: src/dired.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/dired.c,v retrieving revision 1.123 diff -c -p -r1.123 dired.c *** src/dired.c 24 Jun 2006 07:24:42 -0000 1.123 --- src/dired.c 8 Jul 2006 05:30:06 -0000 *************** extern struct direct *readdir (); *** 99,104 **** --- 99,105 ---- #include "charset.h" #include "coding.h" #include "regex.h" + #include "blockinput.h" /* Returns a search buffer, with a fastmap allocated and ready to go. */ extern struct re_pattern_buffer *compile_pattern (); *************** Elements of the attribute list are: *** 951,960 **** --- 952,963 ---- } else { + BLOCK_INPUT; pw = (struct passwd *) getpwuid (s.st_uid); values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid)); gr = (struct group *) getgrgid (s.st_gid); values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid)); + UNBLOCK_INPUT; } values[4] = make_time (s.st_atime); values[5] = make_time (s.st_mtime); Index: src/editfns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/editfns.c,v retrieving revision 1.416 diff -c -p -r1.416 editfns.c *** src/editfns.c 28 Jun 2006 00:00:57 -0000 1.416 --- src/editfns.c 8 Jul 2006 05:30:06 -0000 *************** Boston, MA 02110-1301, USA. */ *** 56,61 **** --- 56,62 ---- #include "coding.h" #include "frame.h" #include "window.h" + #include "blockinput.h" #ifdef STDC_HEADERS #include <float.h> *************** with that uid, or nil if there is no suc *** 1302,1308 **** --- 1303,1311 ---- return Vuser_login_name; CHECK_NUMBER (uid); + BLOCK_INPUT; pw = (struct passwd *) getpwuid (XINT (uid)); + UNBLOCK_INPUT; return (pw ? build_string (pw->pw_name) : Qnil); } *************** name, or nil if there is no such user. *** 1356,1364 **** if (NILP (uid)) return Vuser_full_name; else if (NUMBERP (uid)) ! pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); else if (STRINGP (uid)) ! pw = (struct passwd *) getpwnam (SDATA (uid)); else error ("Invalid UID specification"); --- 1359,1375 ---- if (NILP (uid)) return Vuser_full_name; else if (NUMBERP (uid)) ! { ! BLOCK_INPUT; ! pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); ! UNBLOCK_INPUT; ! } else if (STRINGP (uid)) ! { ! BLOCK_INPUT; ! pw = (struct passwd *) getpwnam (SDATA (uid)); ! UNBLOCK_INPUT; ! } else error ("Invalid UID specification"); Index: src/fileio.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/fileio.c,v retrieving revision 1.567 diff -c -p -r1.567 fileio.c *** src/fileio.c 23 Jun 2006 10:19:11 -0000 1.567 --- src/fileio.c 8 Jul 2006 05:30:07 -0000 *************** extern int errno; *** 77,82 **** --- 77,83 ---- #include "charset.h" #include "coding.h" #include "window.h" + #include "blockinput.h" #ifdef WINDOWSNT #define NOMINMAX 1 *************** See also the function `substitute-in-fil *** 1386,1392 **** --- 1387,1395 ---- bcopy ((char *) nm, o, p - nm); o [p - nm] = 0; + BLOCK_INPUT; pw = (struct passwd *) getpwnam (o + 1); + UNBLOCK_INPUT; if (pw) { newdir = (unsigned char *) pw -> pw_dir; *************** See also the function `substitute-in-fil *** 1917,1923 **** --- 1920,1928 ---- o[len] = 0; /* Look up the user name. */ + BLOCK_INPUT; pw = (struct passwd *) getpwnam (o + 1); + UNBLOCK_INPUT; if (!pw) error ("\"%s\" isn't a registered user", o + 1); *************** search_embedded_absfilename (nm, endp) *** 2111,2117 **** /* If we have ~user and `user' exists, discard everything up to ~. But if `user' does not exist, leave ~user alone, it might be a literal file name. */ ! if ((pw = getpwnam (o + 1))) return p; else xfree (pw); --- 2116,2125 ---- /* If we have ~user and `user' exists, discard everything up to ~. But if `user' does not exist, leave ~user alone, it might be a literal file name. */ ! BLOCK_INPUT; ! pw = getpwnam (o + 1); ! UNBLOCK_INPUT; ! if (pw) return p; else xfree (pw); _______________________________________________ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug