Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Pb with C system call system()
@ 1997-04-07 13:44 provost
  1997-04-07 17:11 ` Michal Jaegermann
  0 siblings, 1 reply; 2+ messages in thread
From: provost @ 1997-04-07 13:44 UTC (permalink / raw)


Hello,

When I compile a C program on a DEC machine (for exemple DEC 3000/300LX) in
which I use the system call "system()" and I run the program on my Alpha 500
with Linux 2.0.23 (Redhat 4.0), I have an error (err = 32512) whereas it runs
very well on the other DEC machine.

The source of my program is very simple : 

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

main()
{
int err;
extern int errno;

err=system("/bin/ls > toto");
fprintf(stdout,"err = %d\n",err);

}

Have you got an idea ?

Thank you for your help.

+++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Lionel Provost 
+ Ingenieur Systemes & Reseaux, Base de donnees,
+ et Webmaster
+
+ C.N.R.S / Institut d'Astrophysique de Paris
+ 98 Bis Bd Arago
+ 75014 PARIS
+
+ Tel : +33 1 44 32 81 14   e-mail : provost@iap.fr
+ http://www-denis.iap.fr/provost.html
+++++++++++++++++++++++++++++++++++++++++++++++++++++ 

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Pb with C system call system()
  1997-04-07 13:44 Pb with C system call system() provost
@ 1997-04-07 17:11 ` Michal Jaegermann
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Jaegermann @ 1997-04-07 17:11 UTC (permalink / raw)


> 
> When I compile a C program on a DEC machine (for exemple DEC 3000/300LX) in
> which I use the system call "system()" and I run the program on my Alpha 500
> with Linux 2.0.23 (Redhat 4.0), I have an error (err = 32512) whereas it runs
> very well on the other DEC machine.

Hm, 32512 is 0x7f00, i.e. you are getting 127 shifted by 8 bits.

> 
> err=system("/bin/ls > toto");
> fprintf(stdout,"err = %d\n",err);

Manapage says:

       It  is  possible  for  the shell command to return 127, so
       that code is not a sure indication that the execve()  call
       failed; check errno to make sure.

So what about errno?

  Michal

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-04-07 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-07 13:44 Pb with C system call system() provost
1997-04-07 17:11 ` Michal Jaegermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox