From: Ralf Baechle <ralf@linux-mips.org>
To: "Sadashiiv, Halesh" <halesh.sadashiv@ap.sony.com>
Cc: linux-mips@linux-mips.org
Subject: Re: execve errno setting on MIPS
Date: Thu, 18 Sep 2008 23:16:17 +0200 [thread overview]
Message-ID: <20080918211617.GA780@linux-mips.org> (raw)
In-Reply-To: <7B7EF7F090B9804A830ACC82F2CDE95D53F553@insardxms01.ap.sony.com>
On Thu, Sep 18, 2008 at 05:09:35PM +0530, Sadashiiv, Halesh wrote:
> From: "Sadashiiv, Halesh" <halesh.sadashiv@ap.sony.com>
> Date: Thu, 18 Sep 2008 17:09:35 +0530
> To: linux-mips@linux-mips.org
> Subject: execve errno setting on MIPS
> Content-Type: multipart/alternative;
> boundary="----_=_NextPart_001_01C91983.39F24AAB"
>
> Hi all,
>
> Please find the below testcase..
>
> #include <stdio.h>
> #include <limits.h>
> #include <errno.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/types.h>
> #include <sys/stat.h>
>
> #define EXE_NAME "./exe"
>
> char e2BIG[ARG_MAX+1][10];
> char *envList[]={NULL};
>
> int main(void)
> {
> int ret,ind;
>
> for(ind = 0; ind < ARG_MAX+1; ind++)
> strcpy(e2BIG[ind], "helloword");
>
> if ((ret = chmod(EXE_NAME,0744)) != 0){
> printf("chmod failed\n");
> exit(1);
> }
>
> /* whne arg list is too long */
> if ((ret = execve(EXE_NAME,e2BIG,envList)) == -1) {
> if ( errno == E2BIG)
> printf("Test Pass\n");
> else
> printf("Test Fail : Got Errno %d\n", errno);
> exit(0);
> }
> else
> printf("execve worked out of limit\n");
> exit(1);
> }
>
> On MIPS E2BIG is not getting set as errno instead EFAULT is set, while
> on
> other archs like ARM, PowerPC and i686 I am able to get E2BIG.
>
> Please let me know about the issue...
>
> Let EXE_NAME be any executable....
Let there be light:
char *foo[] != char foo[][]
char *e2BIG[ARG_MAX + 1] = {
[0 ... ARG_MAX] = "helloword"
};
for (ind = 0; ind < ARG_MAX + 1; ind++)
strcpy(e2BIG[ind], "helloword");
is different from
char *e2BIG[ARG_MAX + 1] = {
[0 ... ARG_MAX] = "helloword"
};
The one is two dimensional array, the other an array of pointers to char.
Ralf
next prev parent reply other threads:[~2008-09-18 21:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 11:39 execve errno setting on MIPS Sadashiiv, Halesh
2008-09-18 11:39 ` Sadashiiv, Halesh
2008-09-18 21:16 ` Ralf Baechle [this message]
2008-09-18 21:25 ` Thomas Bogendoerfer
-- strict thread matches above, loose matches on Subject: below --
2008-09-19 3:27 Sadashiiv, Halesh
2008-09-19 3:27 ` Sadashiiv, Halesh
2008-09-19 7:48 ` Thomas Bogendoerfer
2008-09-19 3:30 Sadashiiv, Halesh
2008-09-19 3:30 ` Sadashiiv, Halesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080918211617.GA780@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=halesh.sadashiv@ap.sony.com \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox