solaris 10 Sparc (10/08) Studio 12 compiler tst.c (snippet)
strcpy(syscmd, "/sbin/su w001 -c \"/usr/bin/rsh machB /usr/bin/ls\""); pptr = popen(syscmd, "r"); while (fgets(line,sizeof(line),pptr) != NULLP) fprintf(logptr, "%s\n", line); pclose(pptr); - When tst is run from root - (w/no env) works fine - When tst is run from background - (w/no env) works fine - When tst is run from cron - fails to read any data created machB:/tmp/tst.sh to test su & rsh... #!/bin/sh /usr/bin/ls > /tmp/ls.capture - substituted /usr/bin/ls with /tmp/tst.sh in rsh (above) - output to log fine, so, there isn't anything wrong with env or permissions, etc next... - ran truss on tst from root - ran truss on tst from cron Listings are essentially the same, except ENOTTY in various places But - the KEY is - the truss (from cron) shows a buffer of data coming back from the remote 'ls' command WORKS - but the socket is shutdown before the buffer can be read! 15992: read(0, 0xFFBF35DC, 51200) = 0 15982: read(4, " M a p p e r\n a d m i n".., 51200) = 83 15982: write(1, " M a p p e r\n a d m i n".., 83) = 83 15992: shutdown(4, SHUT_WR, SOV_DEFAULT) = 0 15957: read(3, " M a p p e r\n a d m i n".., 5120) = 83 15982: pollsys(0xFFBF3398, 1, 0x00000000, 0x00000000) = 1 15982: read(4, 0xFFBF35DC, 51200) = 0 15982: kill(15992, SIGKILL) = 0 15982: _exit(0) Mapper\nadmin\n... is the CORRECT buffer of file names on the remote directory. So everything succeeds - except being able to 'read' the contents of the buffer. I see the write(1, ...) which should be a write to stdout, but it is followed by the shutdown(). I have tried a fread() - instead of fgets(), but no difference. So - the question is - how do I prevent socket from closing early in this scenario. I've tried everything I can think of. (I have tried -n option for rsh, no joy). Appreciate any insight into what is triggering this problem. Thx! Dan -- This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code