Page 1 of 1
popen_exec.c fails to compile
Posted: Thu Mar 08, 2018 10:50 am
by mhanu
Hi,
I tried to compile ember 2.0 but I get the following error:
popen_exec.c: in function »pclose_exec«:
popen_exec.c:280:13: error: storage size of »pstat« isn’t known
union wait pstat;
^~~~~
make[4]: *** [Makefile.full:187: popen_exec.o] error 1
Marcel
Re: popen_exec.c fails to compile
Posted: Thu Mar 08, 2018 8:46 pm
by david
Hi
We know it compiles on the platforms we use and test against. Can you provide some details of the platform you are using? (operating system distro, version etc).
Thanks
David
...
Re: popen_exec.c fails to compile
Posted: Fri Mar 09, 2018 1:32 pm
by mhanu
Hi
I tried to compile it on two different systems.
System 1
- Raspberry Pi Zero W
- No distribution: Linux From Scratch (
http://www.linuxfromscratch.org/lfs/view/development/) and PiLFS (
http://intestinate.com/pilfs/)
- Linux Kernel 4.9.78
- gcc version 7.2.0
System 2
- Debian 9.3 (64bit)
- Linux Kernel 4.9.0-6-amd64
- gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
Thanks
Marcel
Re: popen_exec.c fails to compile
Posted: Sun Mar 11, 2018 9:40 pm
by david
Hi
We develop and test against Centos6, Centos7, and Ubuntu14. I'll see if we can spin up a Debian9 box to replicate your issue. The deb manpage shows that waitpid() needs to include sys/types.h and sys/wait.h which are both already being included.
Thanks
David
...
Re: popen_exec.c fails to compile
Posted: Mon Apr 02, 2018 9:15 am
by mhanu
Hi
I did a quick and maybe dirty patch to make it work. Could you please review the patch?
Code: Select all
--- a/popen_exec.c 2017-02-13 01:38:03.000000000 +0100
+++ b/popen_exec.c 2018-04-02 10:53:40.454237203 +0200
@@ -277,7 +277,8 @@
{
register int fdes;
sigset_t omask, nmask;
- union wait pstat;
+ //union wait pstat;
+ int pstat;
register int pid;
/*
@@ -294,11 +295,12 @@
sigaddset(&nmask, SIGHUP);
(void) sigprocmask(SIG_BLOCK, &nmask, &omask);
do {
- pid = waitpid(pids[fdes], (int *) &pstat, 0);
+ pid = waitpid(pids[fdes], &pstat, 0);
} while (pid == -1 && errno == EINTR);
(void) sigprocmask(SIG_SETMASK, &omask, NULL);
pids[fdes] = 0;
- return (pid == -1 ? -1 : pstat.w_status);
+ //return (pid == -1 ? -1 : pstat.w_status);
+ return (pid == -1 ? -1 : WEXITSTATUS(pstat));
}
Marcel
Re: popen_exec.c fails to compile
Posted: Mon Apr 02, 2018 11:02 pm
by david
Hi
That's fine and in fact looks exactly like what we have now. Our code is flagged for a new release which should happen some time this week.
Thanks
David
...