Those 4 memcpy()s are copying the things referenced by the old
filedesc to the new one.  The things being copied are file*s,
not file**s. They're the same size anyway, but still...


Index: sys/kern/kern_descrip.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_descrip.c,v
retrieving revision 1.108
diff -u -p -r1.108 kern_descrip.c
--- sys/kern/kern_descrip.c     15 May 2014 03:52:25 -0000      1.108
+++ sys/kern/kern_descrip.c     15 Jun 2014 19:57:00 -0000
@@ -956,7 +956,7 @@ fdcopy(struct process *pr)
                    M_FILEDESC, M_WAITOK);
        }
        newfdp->fd_nfiles = i;
-       memcpy(newfdp->fd_ofiles, fdp->fd_ofiles, i * sizeof(struct file **));
+       memcpy(newfdp->fd_ofiles, fdp->fd_ofiles, i * sizeof(struct file *));
        memcpy(newfdp->fd_ofileflags, fdp->fd_ofileflags, i * sizeof(char));
        memcpy(newfdp->fd_himap, fdp->fd_himap, NDHISLOTS(i) * sizeof(u_int));
        memcpy(newfdp->fd_lomap, fdp->fd_lomap, NDLOSLOTS(i) * sizeof(u_int));

Reply via email to