site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jul 6, 2007, at 11:07 , Norm Green wrote: If I run: int rc = system("date >/usr/tmp/tmp.kPCvVa"); If fails with rc == 256 and errno == 0 and prints this to stderr: You are not having a good time with file descriptors, are you? Justin -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds ----------- I'm beginning to like the cut of his jibberish. ----------- _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I cannot get the system command to work from within my program and I see a strange error message printed to stdout/stderr when I try. sh: line 1: 1: Bad file descriptor To make it even more weird: if I start the process under gdb and run the code, it works perfectly! One possibility is "good garbage vs. bad garbage". The environment with gdb will be different than without (gdb and the shell both fork () and then exec() the program in question, but there will be different garbage lying around in memory, in the two cases). Make sure you actually aren't using lots of descriptors (as Terry suggested). The probability is high that it's your code, not Mac OS X, that is at fault. It's no guarantee either way, of course, but without something more concrete to go on, it will be hard to diagnose. None of your problems show up for me in simple test cases, so whatever else is going on, it's either your code causing the problem, or your code exacerbating a problem in the system that hasn't been seen before. A few random thoughts: Do you have more than one Mac OS X system to try this on? Have you replaced/added memory in the system you are using? Do the the system or console logs show anything that seems off-beat? This email sent to site_archiver@lists.apple.com
participants (1)
-
Justin C. Walker