[Python-checkins] python/dist/src/Modules posixmodule.c,2.276,2.277

Neal Norwitz neal@metaslash.com
Tue, 31 Dec 2002 08:04:24 -0500


> Index: posixmodule.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
> retrieving revision 2.276
> retrieving revision 2.277
> diff -C2 -d -r2.276 -r2.277
> *** posixmodule.c	27 Dec 2002 10:16:42 -0000	2.276
> --- posixmodule.c	31 Dec 2002 12:55:15 -0000	2.277
> ***************
> *** 2756,2759 ****
> --- 2765,2791 ----
>   	if (slave_fd < 0)
>   		return posix_error();
> + #else
> + 	master_fd = open("/dev/ptmx", O_RDWR | O_NOCTTY); /* open master */
> + 	if (master_fd < 0)
> + 		return posix_error();
> + 	sig_saved = signal(SIGCHLD, SIG_DFL);
> + 	if (grantpt(master_fd) < 0) /* change permission of slave */
> + 		return posix_error();
> + 	if (unlockpt(master_fd) < 0) /* unlock slave */
> + 		return posix_error();
> + 	signal(SIGCHLD, sig_saved);

Don't you need to restore the saved signal if grantpt()/unlockpt() fail?

Neal