minicom/minicom-2.3-rh.patch
Lubomir Rintel c31d5513e4
2008-02-24 20:34:38 +00:00

171 lines
5.1 KiB
Diff

diff -urp minicom-2.3.orig/src/main.c minicom-2.3/src/main.c
--- minicom-2.3.orig/src/main.c 2008-02-02 23:49:53.000000000 +0100
+++ minicom-2.3/src/main.c 2008-02-24 21:26:20.000000000 +0100
@@ -87,7 +87,7 @@ void leave(const char *s)
}
set_privs();
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
if (P_CALLIN[0])
fastsystem(P_CALLIN, NULL, NULL, NULL);
if (real_uid)
@@ -161,10 +161,13 @@ void term_socket_close(void)
int open_term(int doinit, int show_win_on_error)
{
struct stat stt;
+#ifdef NOTNOW
char buf[128];
- int fd, n = 0;
+ int fd;
int pid;
int mask;
+#endif
+ int n = 0;
#ifdef HAVE_ERRNO_H
int s_errno;
#endif
@@ -172,6 +175,8 @@ int open_term(int doinit, int show_win_o
/* Upgrade our status. */
set_privs();
+#ifdef NOTNOW
+
/* First see if the lock file directory is present. */
if (P_LOCK[0] && stat(P_LOCK, &stt) == 0) {
@@ -243,6 +248,30 @@ int open_term(int doinit, int show_win_o
close(fd);
}
+#else
+ lockfile[0] = 0;
+ if (doinit >= 0) {
+ int rc = ttylock(dial_tty);
+ if (rc < 0) {
+ if (access(dial_tty, W_OK) == -1)
+ fprintf(stderr, _("Device %s access failed: %s.\n"),
+ dial_tty, strerror(errno));
+ else
+ fprintf(stderr, _("Device %s lock failed: %s.\n"),
+ dial_tty, strerror(-rc));
+ } else if (rc > 0) {
+ fprintf(stderr, _("Device %s is locked.\n"), dial_tty);
+ } else if (rc == 0) {
+ snprintf(lockfile, sizeof(lockfile), "%s", dial_tty);
+ }
+ if (rc) {
+ if (stdwin) mc_wclose(stdwin, 1);
+ drop_privs();
+ return(-1);
+ }
+ }
+#endif
+
/* Run a special program to disable callin if needed. */
if (doinit > 0 && P_CALLOUT[0]) {
if (fastsystem(P_CALLOUT, NULL, NULL, NULL) < 0) {
@@ -250,7 +279,7 @@ int open_term(int doinit, int show_win_o
mc_wclose(stdwin, 1);
fprintf(stderr, _("Could not setup for dial out.\n"));
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
drop_privs();
return -1;
}
@@ -310,12 +339,12 @@ int open_term(int doinit, int show_win_o
fprintf(stderr, _("minicom: cannot open %s. Sorry.\n"), dial_tty);
#endif
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
drop_privs();
return -1;
}
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
if (show_win_on_error)
werror(_("Cannot open %s!"), dial_tty);
drop_privs();
Only in minicom-2.3/src: main.c.orig
Only in minicom-2.3/src: main.c.rej
diff -urp minicom-2.3.orig/src/minicom.c minicom-2.3/src/minicom.c
--- minicom-2.3.orig/src/minicom.c 2008-02-24 21:21:30.000000000 +0100
+++ minicom-2.3/src/minicom.c 2008-02-24 21:26:07.000000000 +0100
@@ -1548,7 +1548,7 @@ dirty_goto:
set_privs();
keyboard(KUNINSTALL, 0);
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
close(portfd);
/* Please - if your system doesn't have uid_t and/or gid_t, define 'em
* conditionally in "port.h".
Only in minicom-2.3/src: minicom.c.orig
diff -urp minicom-2.3.orig/src/minicom.h minicom-2.3/src/minicom.h
--- minicom-2.3.orig/src/minicom.h 2008-02-02 23:49:53.000000000 +0100
+++ minicom-2.3/src/minicom.h 2008-02-24 21:26:07.000000000 +0100
@@ -35,6 +35,8 @@
#include <time.h>
+#include <baudboy.h>
+
#ifdef USE_SOCKET
#include <sys/socket.h>
#include <sys/un.h>
@@ -84,7 +86,7 @@ EXTERN int tempst; /* Status line is tem
EXTERN int escape; /* Escape code. */
EXTERN int disable_online_time; /* disable online time display */
-EXTERN char lockfile[128]; /* UUCP lock file of terminal */
+EXTERN char lockfile[1024]; /* UUCP lock file of terminal */
EXTERN char homedir[256]; /* Home directory of user */
EXTERN char logfname[PARS_VAL_LEN]; /* Name of the logfile */
EXTERN char username[16]; /* Who is using minicom? */
Only in minicom-2.3/src: minicom.h.orig
diff -urp minicom-2.3.orig/src/updown.c minicom-2.3/src/updown.c
--- minicom-2.3.orig/src/updown.c 2007-10-10 22:18:20.000000000 +0200
+++ minicom-2.3/src/updown.c 2008-02-24 21:26:07.000000000 +0100
@@ -384,8 +384,10 @@ void kermit(void)
{
int status;
int pid, n;
+#ifdef NOTNOW
char buf[81];
int fd;
+#endif
/* Clear screen, set keyboard modes etc. */
mc_wleave();
@@ -399,7 +401,7 @@ void kermit(void)
/* Remove lockfile */
set_privs();
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
setgid((gid_t)real_gid);
setuid((uid_t)real_uid);
@@ -420,6 +422,7 @@ void kermit(void)
/* Re-create lockfile */
if (lockfile[0]) {
set_privs();
+#ifdef NOTNOW
n = umask(022);
/* Create lockfile compatible with UUCP-1.2 */
if ((fd = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0666)) < 0) {
@@ -431,6 +434,9 @@ void kermit(void)
close(fd);
}
umask(n);
+#else
+ ttylock(lockfile);
+#endif
drop_privs();
}
m_flush(portfd);
Only in minicom-2.3/src: updown.c.orig