Hi,

On Thu, Aug 20, 2015 at 11:52 PM, Cyril Hrubis <chru...@suse.cz> wrote:

> Hi!
> > During the pounder21 test, it gives many errors like:
> >
> > ./pounder: line 262: /dev/tty: No such device or address
> > ./pounder: line 263: /dev/tty: No such device or address
> >
> > After google '/dev/tty', got this description:
> >
> > /dev/tty is the controlling terminal for the current process, if there
> is such a terminal.
> > Do ps -a and look for /dev/tty. If it doesn't appear then that process
> doesn't have a
> > controlling terminal.  It is quite normal for there to be no controlling
> terminal. So if
> > there is no device associated with it then the kernel will just ignore
> anything you send
> > to that file. It only cares if it has attached a device (possibly
> pseudo) to that node. If
> > it does care, and echoing is on, then anything you send to the (special)
> file will be echoed.
>
> Writing directly to /dev/tty is indeed wrong thing to do.
>
> > The second part may be related to the login shell. Check in /etc/passwd
> and make sure that
> > you really do start bash for the user you are logging in as. Using
> /bin/sh instead is a likely cause.
> > So do grep username /etc/passwd and look for the path to the program
> that is launched at the end of
> > the text line. If its /bin/sh then you have the wrong shell. What you
> should have is /bin/bash.
>
> Eh? I do not understand this part at all. It does not seem to be related
> to the problem at all.
>

Okay, it's just try to give an example for declare /dev/tty wrong situation.

I would like to remove them. ;)


>
> > Signed-off-by: Li Wang <liw...@redhat.com>
> > ---
> >  tools/pounder21/Install              |  2 +-
> >  tools/pounder21/fancy_timed_loop.c   |  2 +-
> >  tools/pounder21/infinite_loop.c      |  2 +-
> >  tools/pounder21/pounder              | 14 +++++++-------
> >  tools/pounder21/test_scripts/memtest |  2 +-
> >  tools/pounder21/timed_loop.c         |  2 +-
> >  6 files changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/tools/pounder21/Install b/tools/pounder21/Install
> > index bf13528..6fb3a8f 100755
> > --- a/tools/pounder21/Install
> > +++ b/tools/pounder21/Install
> > @@ -65,7 +65,7 @@ done
> >  # Set up optdir
> >  mkdir -p "$POUNDER_OPTDIR"
> >  if [ ! -d "$POUNDER_OPTDIR" ]; then
> > -     echo "Could not create $POUNDER_OPTDIR; aborting." > /dev/tty
> > +     echo "Could not create $POUNDER_OPTDIR; aborting."
> >       exit 1
> >  fi
> >
> > diff --git a/tools/pounder21/fancy_timed_loop.c
> b/tools/pounder21/fancy_timed_loop.c
> > index cf8580e..50305c3 100644
> > --- a/tools/pounder21/fancy_timed_loop.c
> > +++ b/tools/pounder21/fancy_timed_loop.c
> > @@ -92,7 +92,7 @@ int main(int argc, char *argv[])
> >
> >       tty_fp = fdopen(3, "w+");
> >       if (tty_fp == NULL) {
> > -             tty_fp = fopen("/dev/tty", "w+");
> > +             tty_fp = fdopen(STDOUT_FILENO, "w+");
> >               if (tty_fp == NULL) {
> >                       perror("stdout");
> >                       exit(2);
>
> Can't we rather rename the FILE * to 'out' or similar, naming it tty_fp
> when it does not point to tty is kind of confusing.
>

good.


>
> Also we can simply do FILE *out = stdout; If we reopen it by it's file
> descriptior we will end up with two different file objects, each of them
> will buffer data and we will end up with messed output when something
> will write to stdout and not the one we created.
>

alright.


Thanks for review, I will format patch V2.



>
> --
> Cyril Hrubis
> chru...@suse.cz
>


-- 
Regards,
Li Wang
Email: liw...@redhat.com
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to