Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 2002 08:40:04 -0700 (PDT)
From:      Andriy Gapon <agapon@excite.com>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/43335: libc_r: execve() and close-on-exec flag, interrupted write()
Message-ID:  <200209241540.g8OFe4k8048917@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/43335; it has been noted by GNATS.

From: Andriy Gapon <agapon@excite.com>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: standards/43335: libc_r: execve() and close-on-exec flag,
 interrupted write()
Date: Tue, 24 Sep 2002 11:38:55 -0400 (EDT)

 sorry send-pr has not attached a patch file somehow
 here it is:
 
 diff -crN lib/libc_r/uthread.orig/uthread_execve.c lib/libc_r/uthread/uthread_execve.c
 *** lib/libc_r/uthread.orig/uthread_execve.c	Mon Sep 23 20:27:51 2002
 --- lib/libc_r/uthread/uthread_execve.c	Mon Sep 23 20:28:11 2002
 ***************
 *** 67,76 ****
   		/* Check if this file descriptor is in use: */
   		if (_thread_fd_table[i] != NULL &&
   			!(_thread_fd_table[i]->flags & O_NONBLOCK)) {
 ! 			/* Get the current flags: */
 ! 			flags = _thread_sys_fcntl(i, F_GETFL, NULL);
 ! 			/* Clear the nonblocking file descriptor flag: */
 ! 			_thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
   		}
   	}
 
 --- 67,83 ----
   		/* Check if this file descriptor is in use: */
   		if (_thread_fd_table[i] != NULL &&
   			!(_thread_fd_table[i]->flags & O_NONBLOCK)) {
 ! 			/* get close-on-exec flag */
 ! 			int fd_flags = _thread_sys_fcntl(i, F_GETFD, NULL);
 ! 			if (fd_flags & FD_CLOEXEC == 1) {
 ! 				/* don't bother */
 ! 			}
 ! 			else {
 ! 				/* Get the current flags: */
 ! 				flags = _thread_sys_fcntl(i, F_GETFL, NULL);
 ! 				/* Clear the nonblocking file descriptor flag: */
 ! 				_thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
 ! 			}
   		}
   	}
 
 diff -crN lib/libc_r/uthread.orig/uthread_write.c lib/libc_r/uthread/uthread_write.c
 *** lib/libc_r/uthread.orig/uthread_write.c	Mon Sep 23 20:27:51 2002
 --- lib/libc_r/uthread/uthread_write.c	Mon Sep 23 20:28:11 2002
 ***************
 *** 108,115 ****
   				 * interrupted by a signal
   				 */
   				if (_thread_run->interrupted) {
 ! 					/* Return an error: */
 ! 					ret = -1;
   				}
 
   			/*
 --- 108,120 ----
   				 * interrupted by a signal
   				 */
   				if (_thread_run->interrupted) {
 ! 					if(num > 0)
 ! 						ret = num;
 ! 					else {
 ! 						/* Return an error: */
 ! 						errno = EINTR;
 ! 						ret = -1;
 ! 					}
   				}
 
   			/*
 
 -- 
 Andriy Gapon
 *
 Hang on tightly, let go lightly.
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209241540.g8OFe4k8048917>