Bug 12294 - fopen("/dev/tty","r"); return NULL
Summary: fopen("/dev/tty","r"); return NULL
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-07 21:18 UTC by silvia_si
Modified: 2010-12-07 21:23 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description silvia_si 2010-12-07 21:18:51 UTC

    
Comment 1 silvia_si 2010-12-07 21:23:33 UTC
Ubuntu 10.04 kernel 2.6.32-26-generic 
Netbeans 6.8 
GDB 7.1-ubuntu

Set Console type to Gnome terminal. 

FILE *input = NULL; 
input = fopen("/dev/tty","r"); 
returns NULL in debug mode (works fine in Run mode).

How to re-produce:

#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>

main{
  FILE *input = NULL; 
  input = fopen("/dev/tty","r"); 
}
In debug mode, fopen("/dev/tty","r"); return NULL.

This bug may be related to Bug 11403 - Failed to set controlling terminal,
as "/dev/tty" is the controlling terminal.