Well, the redirection would have to be done using the shell, so making that a list wouldn't help anything.

I am wondering if using kill to send a SIGTERM signal to the spawned program instead of just closing the pipe may help. It shouldn't be necessary, but it does seem you're suffering from something odd Solaris is doing with the files of the spawned program. Perhaps sending a signal (other than SIGKILL or something that can't be handled, preferably SIGTERM as already mentioned) would get the spawned program to close its own open files as it should.

I see the draw of using an external suid program that is already developed and maintained by someone else rather than developing your program to run partially as root. I might make a different decision, but I certainly won't argue with yours. So back to trying to fix the problems with your version we go.

You mention Net::Ping::External, which I hadn't thought about. It does do basically what your program does, but it uses the specific redirections 1>$devnull 2>$devnull as part of its command call. It does this in this particular way regardless of system, actually. The redirections are stated the same way, and although the location of the null device is left as a variable it is one with the '/dev/null' value assigned just the line before. I have no idea whether that will help, but it's a simple enough change to try.

One thing that has occurred to me is that in your example code as posted I didn't notice you doing anything with the data read from the pipe. Are you actually using the read data? If not, system would be a cleaner solution than the piped open. You'd still have the status returned by ping.


In reply to Re^8: old file descriptors not being cleaned up by mr_mischief
in thread old file descriptors not being cleaned up by wagnerc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.