dag@fciva.FRANKLIN.COM (Daniel A. Graifer) (01/21/89)
Somebody please help. We just received our second Prime EXL 386 MultibusII
box (we're running ATT SysV3.0 rel 3), and I broke it. I was setting up our
second (16 line) asynch controller and doing the mknod's for the additional
devices. I wanted to do a chmod 622 /dev/tty1*, but I did chmod 622 /dev/tty*.
I realized my mistake, did an ls -l on our old system, and chmod'd everything
back to the way it is on the old system.
Everything seemed fine until I got on a terminal in my personal account and
tried to look at file with pg (actually, /usr/bin/pg). I got:
pg: unable to reopen stdout
$ who
dag console
$ ls -l /dev/console
crw--w--w- 1 dag other 0, 0 Jan 20 19:01 /dev/console
If I su to root, pg works fine, but (I assume, we don't have source) pg
fails some kind of permission test when it tries to reopen stdout r/w so
it can read your responses to the paging prompts. I wrote the following
program, and it "succeeds".
Anybody got any ideas? Please respond by e-mail if possible, I don't
normally subscribe to this group.
Many thanks in advance.
Dan
Daniel A. Graifer Franklin Capital Investments
uunet!fciva!dag 7900 Westpark Drive, Suite A130
(703)821-3244 McLean, VA 22102
------<cut here>-------
#include <stdio.h>
#include <errno.h>
void main( argc, argv )
int argc; char **argv;
{
FILE *hold;
char *fname;
fname = ttyname( stdout->_file );
(void)printf( "stdout = %s\n", fname);
if ( (hold = freopen( fname, "r+", stdout) ) == NULL )
(void)fprintf( stderr, "freopen failed, errno = %i\n", errno);
else
(void)fprintf( stderr, "freopen succeded\n");
}
/* -----<end program>------- */
--
Daniel A. Graifer Franklin Capital Investments
uunet!fciva!dag 7900 Westpark Drive, Suite A130
(703)821-3244 McLean, VA 22102
dag@fciva.FRANKLIN.COM (Daniel A. Graifer) (01/22/89)
Several people have mailed me solutions to my problem: chmod 666 /dev/tty. Thank to all of you who responded so quickly! Dan Daniel A. Graifer Franklin Capital Investments uunet!fciva!dag 7900 Westpark Drive, Suite A130 (703)821-3244 McLean, VA 22102 -- Daniel A. Graifer Franklin Capital Investments uunet!fciva!dag 7900 Westpark Drive, Suite A130 (703)821-3244 McLean, VA 22102
steved@longs.LANCE.ColoState.Edu (Steve Dempsey) (01/22/89)
In article <449@fciva.FRANKLIN.COM> fciva!dag@uunet.uu.net (Daniel A. Graifer) writes: >Somebody please help. > [...] >I wanted to do a chmod 622 /dev/tty1*, but I did chmod 622 /dev/tty*. -^- >I realized my mistake, did an ls -l on our old system, and chmod'd everything >back to the way it is on the old system. > >Everything seemed fine until I got on a terminal in my personal account and >tried to look at file with pg (actually, /usr/bin/pg). I got: > >pg: unable to reopen stdout > >Anybody got any ideas? Interactive things like pg often use /dev/tty as stdout. I was once frustrated for days by code that behaved like this. It turns out that the it explicitly opened /dev/tty, but reported the error cryptically as `can't open stdout' or some such. Anyway, the fix was to chmod 666 /dev/tty. I suspect that one was overlooked in the repair attempt. >Daniel A. Graifer >uunet!fciva!dag Steve Dempsey, Center for Computer Assisted Engineering Colorado State University, Fort Collins, CO 80523 +1 303 491 0630 INET: steved@longs.LANCE.ColoState.Edu, dempsey@handel.CS.ColoState.Edu UUCP: boulder!ccncsu!longs.LANCE.ColoState.Edu!steved, ...!ncar!handel!dempsey