X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=childio.c;h=43818894b552d869d1a674c3b00d7ee34481353d;hb=d9f4b584106f4d7477158476ff792f6fa0b2630a;hp=6a47d2d4e29bfd892219a20d18a527722a95a392;hpb=7b4dacf6fe9f8c10b6eb4d6070869a3d933dbeb5;p=xboard.git diff --git a/childio.c b/childio.c index 6a47d2d..4381889 100644 --- a/childio.c +++ b/childio.c @@ -2,9 +2,10 @@ * childio.c -- set up communication with child processes * * Copyright 1991 by Digital Equipment Corporation, Maynard, - * Massachusetts. Enhancements Copyright - * 1992-2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software - * Foundation, Inc. + * Massachusetts. + * + * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, + * 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. * * The following terms apply to Digital Equipment Corporation's copyright * interest in XBoard: @@ -58,6 +59,7 @@ #include "config.h" +#include #include #if HAVE_UNISTD_H # include @@ -65,6 +67,7 @@ #include "common.h" #include "frontend.h" +#include "backend.h" /* for safeStrCpy */ #if !USE_PTYS /* This code is for systems where pipes work properly */ @@ -136,7 +139,7 @@ int PseudoTTY(pty_name) if (grantpt(fd) == -1) return -1; if (unlockpt(fd) == -1) return -1; if (!(ptss = ptsname(fd))) return -1; - strcpy(pty_name, ptss); + safeStrCpy(pty_name, ptss, sizeof(pty_name)/sizeof(pty_name[0])); return fd; } @@ -152,7 +155,7 @@ int PseudoTTY(pty_name) ptyn = _getpty(&fd, O_RDWR, 0600, 0); if (ptyn == NULL) return -1; - strcpy(pty_name, ptyn); + safeStrCpy(pty_name, ptyn, sizeof(pty_name)/sizeof(pty_name[0])); return fd; } @@ -168,7 +171,7 @@ int PseudoTTY(pty_name) fd = getpseudotty(&slave, &master); if (fd < 0) return fd; - strcpy(pty_name, slave); + safeStrCpy(pty_name, slave, sizeof(pty_name)/sizeof(pty_name[0])); return fd; } @@ -207,7 +210,7 @@ int PseudoTTY(pty_name) #ifdef PTY_NAME_SPRINTF PTY_NAME_SPRINTF #else - sprintf (pty_name, "/dev/pty%c%x", c, i); + sprintf (pty_name, "/dev/pty%c%x", c, i); #endif /* no PTY_NAME_SPRINTF */ #ifdef PTY_OPEN @@ -231,7 +234,7 @@ int PseudoTTY(pty_name) #ifdef PTY_TTY_NAME_SPRINTF PTY_TTY_NAME_SPRINTF #else - sprintf (pty_name, "/dev/tty%c%x", c, i); + sprintf (pty_name, "/dev/tty%c%x", c, i); #endif /* no PTY_TTY_NAME_SPRINTF */ #ifndef UNIPLUS if (access (pty_name, 6) != 0)