|
Peter Lemenkov |
03eee9 |
From 82764cd53a519b552fb4f62814ca65cd77105f14 Mon Sep 17 00:00:00 2001
|
|
Peter Lemenkov |
03eee9 |
From: Peter Lemenkov <lemenkov@gmail.com>
|
|
Peter Lemenkov |
03eee9 |
Date: Mon, 19 Apr 2010 15:23:49 +0400
|
|
Peter Lemenkov |
03eee9 |
Subject: [PATCH 8/8] Fix for run_erl utility
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
---
|
|
Peter Lemenkov |
03eee9 |
erts/etc/common/Makefile.in | 2 +-
|
|
Peter Lemenkov |
03eee9 |
erts/etc/unix/run_erl.c | 12 ++++++++++++
|
|
Peter Lemenkov |
03eee9 |
2 files changed, 13 insertions(+), 1 deletions(-)
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
|
|
Peter Lemenkov |
03eee9 |
index d0b9a7f..18c2f8d 100644
|
|
Peter Lemenkov |
03eee9 |
--- a/erts/etc/common/Makefile.in
|
|
Peter Lemenkov |
03eee9 |
+++ b/erts/etc/common/Makefile.in
|
|
Peter Lemenkov |
03eee9 |
@@ -280,7 +280,7 @@ $(BINDIR)/inet_gethost@EXEEXT@: $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ)
|
|
Peter Lemenkov |
03eee9 |
$(PURIFY) $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(LIBS)
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
$(BINDIR)/run_erl: $(OBJDIR)/run_erl.o
|
|
Peter Lemenkov |
03eee9 |
- $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/run_erl.o
|
|
Peter Lemenkov |
03eee9 |
+ $(LD) $(LDFLAGS) -lutil -o $@ $(OBJDIR)/run_erl.o
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
$(OBJDIR)/run_erl.o: ../unix/run_erl.c
|
|
Peter Lemenkov |
03eee9 |
$(CC) $(CFLAGS) -o $@ -c ../unix/run_erl.c
|
|
Peter Lemenkov |
03eee9 |
diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c
|
|
Peter Lemenkov |
03eee9 |
index a39ace3..ec73a68 100644
|
|
Peter Lemenkov |
03eee9 |
--- a/erts/etc/unix/run_erl.c
|
|
Peter Lemenkov |
03eee9 |
+++ b/erts/etc/unix/run_erl.c
|
|
Peter Lemenkov |
03eee9 |
@@ -42,6 +42,8 @@
|
|
Peter Lemenkov |
03eee9 |
#include <dirent.h>
|
|
Peter Lemenkov |
03eee9 |
#include <termios.h>
|
|
Peter Lemenkov |
03eee9 |
#include <time.h>
|
|
Peter Lemenkov |
03eee9 |
+#include <pty.h>
|
|
Peter Lemenkov |
03eee9 |
+#include <utmp.h>
|
|
Peter Lemenkov |
03eee9 |
#if !defined(NO_SYSLOG)
|
|
Peter Lemenkov |
03eee9 |
#include <syslog.h>
|
|
Peter Lemenkov |
03eee9 |
#endif
|
|
Peter Lemenkov |
03eee9 |
@@ -803,6 +805,7 @@ static int create_fifo(char *name, int perm)
|
|
Peter Lemenkov |
03eee9 |
static int open_pty_master(char **ptyslave)
|
|
Peter Lemenkov |
03eee9 |
{
|
|
Peter Lemenkov |
03eee9 |
int mfd;
|
|
Peter Lemenkov |
03eee9 |
+ int sfd;
|
|
Peter Lemenkov |
03eee9 |
char *major, *minor;
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
static char majorchars[] = "pqrstuvwxyzabcdePQRSTUVWXYZABCDE";
|
|
Peter Lemenkov |
03eee9 |
@@ -818,6 +821,15 @@ static int open_pty_master(char **ptyslave)
|
|
Peter Lemenkov |
03eee9 |
/* http://www.xcf.berkeley.edu/~ali/K0D/UNIX/PTY/code/upty.h.html */
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
{
|
|
Peter Lemenkov |
03eee9 |
+ static char ttyname[] = " ";
|
|
Peter Lemenkov |
03eee9 |
+ if (0 == openpty(&mfd, &sfd, ttyname, NULL, NULL)) {
|
|
Peter Lemenkov |
03eee9 |
+ close(sfd);
|
|
Peter Lemenkov |
03eee9 |
+ *ptyslave = ttyname;
|
|
Peter Lemenkov |
03eee9 |
+ return mfd;
|
|
Peter Lemenkov |
03eee9 |
+ }
|
|
Peter Lemenkov |
03eee9 |
+ }
|
|
Peter Lemenkov |
03eee9 |
+
|
|
Peter Lemenkov |
03eee9 |
+ {
|
|
Peter Lemenkov |
03eee9 |
/* New style devpts or devfs /dev/pty/{m,s}{0,1....} */
|
|
Peter Lemenkov |
03eee9 |
|
|
Peter Lemenkov |
03eee9 |
static char ptyname[] = "/dev/pty/mX";
|
|
Peter Lemenkov |
03eee9 |
--
|
|
Peter Lemenkov |
03eee9 |
1.6.6.1
|
|
Peter Lemenkov |
03eee9 |
|