Path: utzoo!attcan!uunet!fciva!dag From: dag@fciva.FRANKLIN.COM (Daniel A. Graifer) Newsgroups: comp.unix.wizards Subject: Help! "pg: cannot reopen stdout" Summary: I broke my new system, pg only works for root! Message-ID: <449@fciva.FRANKLIN.COM> Date: 21 Jan 89 00:04:27 GMT Reply-To: fciva!dag@uunet.uu.net (Daniel A. Graifer) Organization: Franklin Capital Investments, Inc. McLean, Va. Lines: 56 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 ------------- #include #include 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"); } /* ------------ */ -- Daniel A. Graifer Franklin Capital Investments uunet!fciva!dag 7900 Westpark Drive, Suite A130 (703)821-3244 McLean, VA 22102