socsvn commit: r253839 - soc2013/dpl/head/contrib/bzip2
dpl at FreeBSD.org
dpl at FreeBSD.org
Tue Jul 2 10:15:09 UTC 2013
Author: dpl
Date: Tue Jul 2 10:15:08 2013
New Revision: 253839
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253839
Log:
False alarm, sendfd actually returns now "Bad file descriptor" error.
Modified:
soc2013/dpl/head/contrib/bzip2/bzip2.c
Modified: soc2013/dpl/head/contrib/bzip2/bzip2.c
==============================================================================
--- soc2013/dpl/head/contrib/bzip2/bzip2.c Tue Jul 2 10:08:16 2013 (r253838)
+++ soc2013/dpl/head/contrib/bzip2/bzip2.c Tue Jul 2 10:15:08 2013 (r253839)
@@ -233,7 +233,7 @@
int
sendfd(int s, int fd)
{
- printf("sendfd sending: %d", fd);
+ printf("sendfd sending: %d\n", fd);
struct msghdr msg;
struct cmsghdr *cmsg;
struct iovec io[1];
@@ -243,7 +243,7 @@
io[0].iov_base = buf;
io[0].iov_len = 1;
- if( (cmsg = malloc(DATALEN) ) == NULL )
+ if( (cmsg = malloc(DATALEN)) == NULL )
return -1;
msg.msg_name = NULL;
@@ -257,10 +257,8 @@
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
*(int *)CMSG_DATA(cmsg) = fd;
- if( (ret = sendmsg(s, &msg, 0)) <= 0){
- printf("sendmsg() returned: %d (%s)\n", ret, strerror(errno));
+ if( (ret = sendmsg(s, &msg, 0)) <= 0)
return -1;
- }
free(cmsg);
return 0;
}
@@ -1409,7 +1407,7 @@
setExit(1);
exit(exitValue);
} else if ( forkpid != 0) {
-
+ printf("Parent= infd:%d, outfd:%d\n", infd, outfd);
if ((close(sv[0])) < 0){
fprintf ( stderr, "%s: Couldn't close fd: %s.\n",
progName, strerror(errno) );
@@ -1417,7 +1415,7 @@
setExit(1);
exit(exitValue);
}
- if ((closeinfd)) < 0){
+ if ((close(infd)) < 0){
fprintf ( stderr, "%s: Couldn't close fd: %s.\n",
progName, strerror(errno) );
setExit(1);
@@ -1448,7 +1446,6 @@
exit(exitValue);
}
/* Let the children compress */
- wait(NULL);
return;
} else if (forkpid == 0){
More information about the svn-soc-all
mailing list