* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * %W% (Berkeley) %G%
*
- * $Id: info_exec.c,v 1.2 2005/03/08 07:47:10 ezk Exp $
+ * $Id: info_exec.c,v 1.3 2005/08/03 00:01:34 ezk Exp $
*
*/
return -1;
}
- switch((p1 = vfork())) {
+ switch ((p1 = vfork())) {
+ case -1:
+ /* parent: fork error */
+ close(nullfd);
+ close(pdes[0]);
+ close(pdes[1]);
+ return -1;
+ case 0:
+ /* child #1 */
+ switch ((p2 = vfork())) {
case -1:
- /* parent: fork error */
- close(nullfd);
- close(pdes[0]);
- close(pdes[1]);
- return -1;
+ /* child #1: fork error */
+ exit(errno);
case 0:
- /* child #1 */
- switch((p2 = vfork())) {
- case -1:
- /* child #1: fork error */
- exit(errno);
- case 0:
- /* child #2: init will reap our status */
- if (pdes[1] != STDOUT_FILENO) {
- dup2(pdes[1], STDOUT_FILENO);
- close(pdes[1]);
- }
-
- if (nullfd != STDERR_FILENO) {
- dup2(nullfd, STDERR_FILENO);
- close(nullfd);
- }
-
- for (i=0; i<FD_SETSIZE; i++)
- if (i != STDOUT_FILENO && i != STDERR_FILENO)
- close(i);
-
- /* make the write descriptor non-blocking */
- if (!set_nonblock(STDOUT_FILENO)) {
- close(STDOUT_FILENO);
- exit(-1);
- }
-
- execve(emap, argv, NULL);
- exit(errno); /* in case execve failed */
+ /* child #2: init will reap our status */
+ if (pdes[1] != STDOUT_FILENO) {
+ dup2(pdes[1], STDOUT_FILENO);
+ close(pdes[1]);
+ }
+
+ if (nullfd != STDERR_FILENO) {
+ dup2(nullfd, STDERR_FILENO);
+ close(nullfd);
}
- /* child #1 */
- exit(0);
+ for (i=0; i<FD_SETSIZE; i++)
+ if (i != STDOUT_FILENO && i != STDERR_FILENO)
+ close(i);
+
+ /* make the write descriptor non-blocking */
+ if (!set_nonblock(STDOUT_FILENO)) {
+ close(STDOUT_FILENO);
+ exit(-1);
+ }
+
+ execve(emap, argv, NULL);
+ exit(errno); /* in case execve failed */
+ }
+
+ /* child #1 */
+ exit(0);
}
/* parent */
close(pdes[1]);
/* anti-zombie insurance */
- while(waitpid(p1,0,0) < 0)
+ while (waitpid(p1,0,0) < 0)
if (errno != EINTR)
exit(errno);
* SUCH DAMAGE.
*
*
- * $Id: mount_linux.c,v 1.44 2005/07/29 10:47:19 ezk Exp $
+ * $Id: mount_linux.c,v 1.45 2005/08/03 00:01:35 ezk Exp $
*/
/*
somedev++;
fd = open(dev, O_RDONLY);
if (fd >= 0) {
- if(ioctl(fd, LOOP_GET_STATUS, &loopinfo) == 0)
+ if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) == 0)
someloop++; /* in use */
else if (errno == ENXIO) {
close(fd);
if (!somedev) {
dlog("Could not find any device /dev/loop#");
- } else if(!someloop) {
+ } else if (!someloop) {
if (loop_known == 1) {
dlog("Could not find any loop device.");
dlog("...Maybe /dev/loop# has a wrong major number?");
* SUCH DAMAGE.
*
*
- * $Id: wire.c,v 1.24 2005/06/23 20:48:42 ezk Exp $
+ * $Id: wire.c,v 1.25 2005/08/03 00:01:35 ezk Exp $
*
*/
*/
if (!np) {
u_long short_subnet = subnet;
- while(short_subnet && (short_subnet & 0x000000ff) == 0)
+ while (short_subnet && (short_subnet & 0x000000ff) == 0)
short_subnet >>= 8;
np = getnetbyaddr(short_subnet, AF_INET);
if (np)