aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorStefan Monnier2003-05-25 17:43:20 +0000
committerStefan Monnier2003-05-25 17:43:20 +0000
commit34967d0ff431961dc4ef86d6eb12e19e176963f2 (patch)
tree1e3215f41a1994745346d942cda1ca9c5c84aedf /src/process.c
parentf84d8a709ac1d19d7ca31f43ba3442d90fe55f07 (diff)
downloademacs-34967d0ff431961dc4ef86d6eb12e19e176963f2.tar.gz
emacs-34967d0ff431961dc4ef86d6eb12e19e176963f2.zip
(allocate_pty): Remove `unused var stb' and
`cp might be used uninitialized' warnings.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/src/process.c b/src/process.c
index 9790b7d29a6..9d7f145dcde 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1,6 +1,6 @@
1/* Asynchronous subprocess control for GNU Emacs. 1/* Asynchronous subprocess control for GNU Emacs.
2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 96, 98, 1999, 2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 96, 98, 1999,
3 2001, 2002 Free Software Foundation, Inc. 3 2001, 2002, 2003 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -459,17 +459,9 @@ status_message (status)
459int 459int
460allocate_pty () 460allocate_pty ()
461{ 461{
462 struct stat stb;
463 register int c, i; 462 register int c, i;
464 int fd; 463 int fd;
465 464
466 /* Some systems name their pseudoterminals so that there are gaps in
467 the usual sequence - for example, on HP9000/S700 systems, there
468 are no pseudoterminals with names ending in 'f'. So we wait for
469 three failures in a row before deciding that we've reached the
470 end of the ptys. */
471 int failed_count = 0;
472
473#ifdef PTY_ITERATION 465#ifdef PTY_ITERATION
474 PTY_ITERATION 466 PTY_ITERATION
475#else 467#else
@@ -486,28 +478,39 @@ allocate_pty ()
486#ifdef PTY_OPEN 478#ifdef PTY_OPEN
487 PTY_OPEN; 479 PTY_OPEN;
488#else /* no PTY_OPEN */ 480#else /* no PTY_OPEN */
489#ifdef IRIS 481 {
490 /* Unusual IRIS code */ 482 struct stat stb;
491 *ptyv = emacs_open ("/dev/ptc", O_RDWR | O_NDELAY, 0); 483# ifdef IRIS
492 if (fd < 0) 484 /* Unusual IRIS code */
493 return -1; 485 *ptyv = emacs_open ("/dev/ptc", O_RDWR | O_NDELAY, 0);
494 if (fstat (fd, &stb) < 0) 486 if (fd < 0)
495 return -1; 487 return -1;
496#else /* not IRIS */ 488 if (fstat (fd, &stb) < 0)
497 if (stat (pty_name, &stb) < 0) 489 return -1;
498 { 490# else /* not IRIS */
499 failed_count++; 491 { /* Some systems name their pseudoterminals so that there are gaps in
500 if (failed_count >= 3) 492 the usual sequence - for example, on HP9000/S700 systems, there
501 return -1; 493 are no pseudoterminals with names ending in 'f'. So we wait for
494 three failures in a row before deciding that we've reached the
495 end of the ptys. */
496 int failed_count = 0;
497
498 if (stat (pty_name, &stb) < 0)
499 {
500 failed_count++;
501 if (failed_count >= 3)
502 return -1;
503 }
504 else
505 failed_count = 0;
502 } 506 }
503 else 507# ifdef O_NONBLOCK
504 failed_count = 0; 508 fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
505#ifdef O_NONBLOCK 509# else
506 fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0); 510 fd = emacs_open (pty_name, O_RDWR | O_NDELAY, 0);
507#else 511# endif
508 fd = emacs_open (pty_name, O_RDWR | O_NDELAY, 0); 512# endif /* not IRIS */
509#endif 513 }
510#endif /* not IRIS */
511#endif /* no PTY_OPEN */ 514#endif /* no PTY_OPEN */
512 515
513 if (fd >= 0) 516 if (fd >= 0)
@@ -523,11 +526,11 @@ allocate_pty ()
523 if (access (pty_name, 6) != 0) 526 if (access (pty_name, 6) != 0)
524 { 527 {
525 emacs_close (fd); 528 emacs_close (fd);
526#if !defined(IRIS) && !defined(__sgi) 529# if !defined(IRIS) && !defined(__sgi)
527 continue; 530 continue;
528#else 531# else
529 return -1; 532 return -1;
530#endif /* IRIS */ 533# endif /* IRIS */
531 } 534 }
532#endif /* not UNIPLUS */ 535#endif /* not UNIPLUS */
533 setup_pty (fd); 536 setup_pty (fd);
@@ -2203,7 +2206,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
2203 int len; 2206 int len;
2204{ 2207{
2205 register struct Lisp_Vector *p; 2208 register struct Lisp_Vector *p;
2206 register unsigned char *cp; 2209 register unsigned char *cp = NULL;
2207 register int i; 2210 register int i;
2208 2211
2209 bzero (sa, len); 2212 bzero (sa, len);