Help! "pg: cannot reopen stdout"

Daniel A. Graifer dag at fciva.FRANKLIN.COM
Sat Jan 21 10:04:27 AEST 1989


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



More information about the Comp.unix.wizards mailing list