minicom/minicom-2.2-rh.patch
Miroslav Lichvar 0f0e704dc8 - update to 2.2
- handle filenames with spaces (#98655)
- add requires for lrzsz
- spec cleanup Resolves: #98655
2007-03-09 12:19:02 +00:00

162 lines
4.3 KiB
Diff

--- minicom-2.2/src/main.c.rh 2005-10-31 13:13:51.000000000 +0100
+++ minicom-2.2/src/main.c 2007-03-09 13:10:12.000000000 +0100
@@ -82,7 +82,7 @@
}
set_privs();
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
if (P_CALLIN[0])
fastsystem(P_CALLIN, NULL, NULL, NULL);
if (real_uid)
@@ -154,10 +154,13 @@
int open_term(int doinit)
{
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
@@ -165,6 +168,8 @@
/* 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) {
@@ -236,6 +241,30 @@
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) 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) {
@@ -243,7 +272,7 @@
wclose(stdwin, 1);
fprintf(stderr, _("Could not setup for dial out.\n"));
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
drop_privs();
return -1;
}
@@ -303,12 +332,12 @@
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);
werror(_("Cannot open %s!"), dial_tty);
drop_privs();
return -1;
--- minicom-2.2/src/minicom.h.rh 2005-10-31 12:10:57.000000000 +0100
+++ minicom-2.2/src/minicom.h 2007-03-09 13:10:12.000000000 +0100
@@ -29,6 +29,8 @@
#include "vt100.h"
#include "libport.h"
+#include <baudboy.h>
+
#ifdef USE_SOCKET
#include <sys/socket.h>
#include <sys/un.h>
@@ -78,7 +80,7 @@
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? */
--- minicom-2.2/src/minicom.c.rh 2007-03-09 13:10:12.000000000 +0100
+++ minicom-2.2/src/minicom.c 2007-03-09 13:10:12.000000000 +0100
@@ -1532,7 +1532,7 @@
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".
--- minicom-2.2/src/updown.c.rh 2005-08-14 22:39:30.000000000 +0200
+++ minicom-2.2/src/updown.c 2007-03-09 13:10:12.000000000 +0100
@@ -380,8 +380,10 @@
{
int status;
int pid, n;
+#ifdef NOTNOW
char buf[81];
int fd;
+#endif
/* Clear screen, set keyboard modes etc. */
wleave();
@@ -395,7 +397,7 @@
/* Remove lockfile */
set_privs();
if (lockfile[0])
- unlink(lockfile);
+ ttyunlock(lockfile);
setgid((gid_t)real_gid);
setuid((uid_t)real_uid);
@@ -416,6 +418,7 @@
/* 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) {
@@ -427,6 +430,9 @@
close(fd);
}
umask(n);
+#else
+ ttylock(lockfile);
+#endif
drop_privs();
}
m_flush(portfd);