patch-2.4.0-test11 linux/net/core/scm.c
Next file: linux/net/core/sock.c
Previous file: linux/net/core/dev.c
Back to the patch index
Back to the overall index
- Lines: 27
- Date:
Thu Nov 9 15:57:53 2000
- Orig file:
v2.4.0-test10/linux/net/core/scm.c
- Orig date:
Fri Sep 3 14:13:09 1999
diff -u --recursive --new-file v2.4.0-test10/linux/net/core/scm.c linux/net/core/scm.c
@@ -204,12 +204,16 @@
{
struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
- int fdmax = (msg->msg_controllen - sizeof(struct cmsghdr))/sizeof(int);
+ int fdmax = 0;
int fdnum = scm->fp->count;
struct file **fp = scm->fp->fp;
int *cmfptr;
int err = 0, i;
+ if (msg->msg_controllen > sizeof(struct cmsghdr))
+ fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr))
+ / sizeof(int));
+
if (fdnum < fdmax)
fdmax = fdnum;
@@ -245,7 +249,7 @@
msg->msg_controllen -= cmlen;
}
}
- if (i < fdnum)
+ if (i < fdnum || (fdnum && fdmax <= 0))
msg->msg_flags |= MSG_CTRUNC;
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)