[ksh93-integration-discuss] Toy/prototype patch top add "shcomp" + "shbinexec" kernel module...

I. Szczesniak iszczesniak at gmail.com
Wed Sep 6 07:56:02 PDT 2006


On 9/6/06, Roland Mainz <roland.mainz at nrubsig.org> wrote:
> +static int
> +getshbinhead(struct vnode *vp, struct intpdata *idatap)
> +{
> +       int error;
> +       char *cp, *linep = idatap->intp;
> +       ssize_t resid;
> +
> +       /*
> +        * Read the entire line and confirm that it starts with '#!'.
> +        */
> +       if (error = vn_rdwr(UIO_READ, vp, linep, INTPSZ, (offset_t)0,
> +           UIO_SYSSPACE, 0, (rlim64_t)0, CRED(), &resid))
> +               return (error);
> +
> +       if (!memcmp(linep, shbinmagicstr, SHBINMAGIC_LEN))
> +               return (ENOEXEC);

I think the logic needs to be reversed. The memcmp function returns 0
for an equal match and in this case your code returns ENOEXEC.

Irek



More information about the ksh93-integration-discuss mailing list