Is the line:

" const int minut_1 = -1;" 

Just a typo or is it in fact passing a different value for minus_1?

I'm guessing the former, as I would have thought you would get a compiler error.

Mike Kean

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Tuesday, February 25, 2014 2:23 PM
To: [email protected]
Subject: OpenSSH question / oddity

I am writing a program which "daemonizes" itself. That is, if it is invoked 
from a UNIX shell, it will close all the open file descriptors, do a setsid to 
put itself into its own, unique, process group, and do the "double fork()" 
which I read about in a advance UNIX programming book.

If I run this program using TSO OMVS or a standard telnet connection to a UNIX 
prompt, everything works well. But if I logon via an ssh tunnel to a UNIX 
prompt, the code to close all descriptors:

const int zero = 0;
const int minut_1 = -1;
...
rc = fcntl(zero, F_CLOSFD, minus_1);

Will return with rc == -1 (error), an errno value of 139 (EPERM) and a errnojr 
value of 0x0B28E128. Looking this up with bpxmtext only says:
BPXPRIPK 07/18/08
There is a hit on this, but for HBB7780. I'm on HBB7770 (z/OS 1.12). There are 
no messages on the z/OS SYSLOG.

Any ideas? I can just ignore the -1 return code but I really, really, really 
don't like doing that.

--
Wasn't there something about a PASCAL programmer knowing the value of 
everything and the Wirth of nothing?

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to