delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/12/24/13:40:24

From: cgf AT cygnus DOT com (Christopher Faylor)
Subject: Re: Problems with winsup-981223
24 Dec 1998 13:40:24 -0800 :
Message-ID: <19981224162318.A494.cygnus.cygwin32.developers@cygnus.com>
References: <36820E45 DOT F08619FA AT cityweb DOT de>
Mime-Version: 1.0
To: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>,
cygwin32-developers AT cygnus DOT com

On Thu, Dec 24, 1998 at 10:49:57AM +0100, Corinna Vinschen wrote:
>if compiling with -D_MT_SAFE=1:
>-----------
>In file included from winsup.h:37,
>                 from assert.cc:11:
>thread.h:99: field `_localtime_buf' has incomplete type
>make: *** [assert.o] Error 1
>-----------
>This is corrected by additional #include <time.h>

Hmm.  I don't see this and neither does DJ.  Maybe something has
changed in newlib.

>While linking:
>-----------
>undefined symbol from libc.a(execvp.o): posix_path_list_p
>-----------
>The function now is named 'cygwin_posix_path_list_p',
>which I have corrected by changing the call in libc::execvp.c

Yes.  You've probably seen my other email on this.

>Now it's compilable and linkable, but 
>- if it's compiled with -D_MT_SAFE=1, starting e.g. tcsh from
>  cmd results in immediate exit of tcsh without any error output.
>- if it's compiled without thread safeness, it doesn't run correct
>  in tty mode. The telnet session suddenly outputs `ogin:' instead
>  of `login:' and the first key press results in lost connection
>  to telnetd.

This should fix the non-threadsafe case.  I haven't checked the threadsafe
version yet.

cgf

Index: ioctl.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/ioctl.cc,v
retrieving revision 1.11
diff -u -p -r1.11 ioctl.cc
--- ioctl.cc	1998/12/18 21:47:55	1.11
+++ ioctl.cc	1998/12/24 21:14:45
@@ -26,7 +26,7 @@ ioctl (int fd, int cmd, void *buf)
     }
 
   fhandler_base *fh = dtable[fd];
-  if (fh->is_tty ())
+  if (fh->is_tty () && fh->get_device () != FH_PTYM)
     switch (cmd)
       {
 	case TCGETA:
Index: passwd.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/passwd.cc,v
retrieving revision 1.29
diff -u -p -r1.29 passwd.cc
--- passwd.cc	1998/12/17 04:29:13	1.29
+++ passwd.cc	1998/12/24 21:14:45
@@ -234,16 +234,25 @@ getpass (const char * prompt)
   if (!passwd_in_memory_p)
     read_etc_passwd();
 
-  tcgetattr (0, &ti);
-  newti = ti;
-  newti.c_lflag &= ~ECHO;
-  tcsetattr (0, TCSANOW, &newti);
-  fprintf (stderr, prompt);
-  fgets (pass, _PASSWORD_LEN, stdin);
-  fprintf (stderr, "\n");
-  for (int i=0; pass[i]; i++)
-    if (pass[i] == '\r' || pass[i] == '\n')
-      pass[i] = '\0';
-  tcsetattr (0, TCSANOW, &ti);
+  if (dtable.not_open (0))
+    {
+      set_errno (EBADF);
+      pass[0] = '\0';
+    }
+  else
+    {
+      fhandler_base *fhstdin = dtable[0];
+      fhstdin->tcgetattr (&ti);
+      newti = ti;
+      newti.c_lflag &= ~ECHO;
+      fhstdin->tcsetattr (TCSANOW, &newti);
+      fprintf (stderr, prompt);
+      fgets (pass, _PASSWORD_LEN, stdin);
+      fprintf (stderr, "\n");
+      for (int i=0; pass[i]; i++)
+	if (pass[i] == '\r' || pass[i] == '\n')
+	  pass[i] = '\0';
+      fhstdin->tcsetattr (TCSANOW, &ti);
+    }
   return pass;
 }
Index: termios.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/termios.cc,v
retrieving revision 1.26
diff -u -p -r1.26 termios.cc
--- termios.cc	1998/12/18 21:47:58	1.26
+++ termios.cc	1998/12/24 21:14:45
@@ -99,6 +99,7 @@ tcsetattr (int fd, int a, const struct t
 {
   int res = -1;
 
+  t = __tonew_termios (t);
   if (dtable.not_open (fd))
     set_errno (EBADF);
   else if (!dtable[fd]->is_tty ())
@@ -106,11 +107,12 @@ tcsetattr (int fd, int a, const struct t
   else
     {
       sig_protect (here, 1);
-      res = dtable[fd]->tcsetattr (a, __tonew_termios (t));
+      res = dtable[fd]->tcsetattr (a, t);
     }
 
-  termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x",
-	t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag);
+  termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d",
+	t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
+	t->c_cc[VTIME]);
   termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t);
   return res;
 }
@@ -121,6 +123,7 @@ int
 tcgetattr (int fd, struct termios *in_t)
 {
   int res = -1;
+  struct termios *t = __makenew_termios (in_t);
 
   if (dtable.not_open (fd))
     set_errno (EBADF);
@@ -129,12 +132,17 @@ tcgetattr (int fd, struct termios *in_t)
   else
     {
       sig_protect (here, 1);
-      struct termios *t = __makenew_termios (in_t);
       if ((res = dtable[fd]->tcgetattr (t)) == 0)
 	__toapp_termios (in_t, t); 
     }
 
-  termios_printf ("%d = tcgetattr (%d, %x)", res, fd, in_t);
+  if (res)
+    termios_printf ("%d = tcgetattr (%d, %x)", res, fd, in_t);
+  else
+    termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d",
+	  t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
+	  t->c_cc[VTIME]);
+
   return res;
 }
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019