Simplify by avoiding confusing use of strncpy etc.
[bpt/emacs.git] / src / s / sol2-6.h
index bb7a985..ec45748 100644 (file)
@@ -54,8 +54,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
       { emacs_close (fd); return -1; }         \
     if (!(ptyname = ptsname (fd)))             \
       { emacs_close (fd); return -1; }         \
-    strncpy (pty_name, ptyname, sizeof (pty_name)); \
-    pty_name[sizeof (pty_name) - 1] = 0;       \
+    snprintf (pty_name, sizeof pty_name, "%s", ptyname); \
   }
 
 #define GC_SETJMP_WORKS 1