diff --git a/minicom-2.5-rh.patch b/minicom-2.5-rh.patch deleted file mode 100644 index fcfe035..0000000 --- a/minicom-2.5-rh.patch +++ /dev/null @@ -1,162 +0,0 @@ -diff --git a/src/main.c b/src/main.c -index bc4db89..8e68e2c 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -154,16 +154,22 @@ void term_socket_close(void) - int open_term(int doinit, int show_win_on_error, int no_msgs) - { - struct stat stt; -+#ifdef NOTNOW - union { - char bytes[128]; - int kermit; - } buf; -- int fd, n = 0; -+ int fd; - int pid; -+#endif -+ int rc; -+ int n = 0; - #ifdef HAVE_ERRNO_H - int s_errno; - #endif - -+#ifdef NOTNOW -+ - /* First see if the lock file directory is present. */ - if (P_LOCK[0] && stat(P_LOCK, &stt) == 0) { - -@@ -215,6 +221,47 @@ int open_term(int doinit, int show_win_on_error, int no_msgs) - if (doinit > 0) - lockfile_create(); - -+#else -+ lockfile[0] = 0; -+ if (doinit > 0) { -+#ifdef USE_SOCKET -+ if (strncmp(dial_tty, SOCKET_PREFIX, strlen(SOCKET_PREFIX)) == 0) { -+ if (stat(dial_tty+strlen(SOCKET_PREFIX), &stt) == 0 && -+ S_ISSOCK(stt.st_mode)) { -+ rc = 0; -+ } else { -+ rc = 1; -+ if (!no_msgs) -+ fprintf(stderr, _("File %s is not a socket.\n"), -+ dial_tty+strlen(SOCKET_PREFIX)); -+ } -+ } else { -+#endif -+ rc = ttylock(dial_tty); -+ if(!no_msgs) { -+ 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); -+ } -+ } -+#ifdef USE_SOCKET -+ } -+#endif -+ if (rc == 0) { -+ snprintf(lockfile, sizeof(lockfile), "%s", dial_tty); -+ } else { -+ if (!no_msgs && stdwin) mc_wclose(stdwin, 1); -+ 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) { -@@ -232,7 +276,6 @@ int open_term(int doinit, int show_win_on_error, int no_msgs) - signal(SIGALRM, get_alrm); - alarm(4); - #ifdef USE_SOCKET --#define SOCKET_PREFIX "unix#" - portfd_is_socket = portfd_is_connected = 0; - if (strncmp(dial_tty, SOCKET_PREFIX, strlen(SOCKET_PREFIX)) == 0) { - portfd_is_socket = 1; -diff --git a/src/minicom.c b/src/minicom.c -index 7780ff7..8b26f0d 100644 ---- a/src/minicom.c -+++ b/src/minicom.c -@@ -1569,8 +1569,7 @@ dirty_goto: - mc_wclose(st, 0); - mc_wclose(stdwin, 1); - keyboard(KUNINSTALL, 0); -- if (lockfile[0]) -- unlink(lockfile); -+ lockfile_remove(); - close(portfd); - - if (quit != NORESET && P_CALLIN[0]) -diff --git a/src/minicom.h b/src/minicom.h -index 309d54a..83f3fca 100644 ---- a/src/minicom.h -+++ b/src/minicom.h -@@ -34,10 +34,14 @@ - #include "libport.h" - - #include -+#include -+#include - - #ifdef USE_SOCKET - #include - #include -+ -+#define SOCKET_PREFIX "unix#" - #endif - - /* -@@ -82,7 +86,7 @@ EXTERN int tempst; /* Status line is temporary */ - 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[PATH_MAX]; /* 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? */ -diff --git a/src/updown.c b/src/updown.c -index 24531a2..23194e4 100644 ---- a/src/updown.c -+++ b/src/updown.c -@@ -441,12 +441,14 @@ void updown(int what, int nr) - - void lockfile_remove(void) - { -- if (lockfile[0]) -- unlink(lockfile); -+ if (lockfile[0] && strncmp(dial_tty, SOCKET_PREFIX, strlen(SOCKET_PREFIX)) != 0) -+ ttyunlock(lockfile); - } - - void lockfile_create(void) - { -+ int rc; -+#ifdef NOTNOW - int fd, n; - - if (!lockfile[0]) -@@ -468,6 +470,14 @@ void lockfile_create(void) - close(fd); - } - umask(n); -+#else -+ if (strncmp(dial_tty, SOCKET_PREFIX, strlen(SOCKET_PREFIX)) != 0) { -+ rc = ttylock(lockfile); -+ if (rc) { -+ werror(_("Cannot lock device!")); -+ } -+ } -+#endif - } - - /* diff --git a/minicom.spec b/minicom.spec index d1c6847..b822f26 100644 --- a/minicom.spec +++ b/minicom.spec @@ -1,7 +1,7 @@ Summary: A text-based modem control and terminal emulation program Name: minicom Version: 2.5 -Release: 4%{?dist} +Release: 5%{?dist} URL: http://alioth.debian.org/projects/minicom/ License: GPLv2+ Group: Applications/Communications @@ -12,10 +12,9 @@ Requires: lockdev lrzsz Source0: http://alioth.debian.org/frs/download.php/3487/minicom-2.5.tar.gz -Patch1: minicom-2.5-rh.patch -Patch2: minicom-2.5-non-readable-dir.patch -Patch3: minicom-2.5-man-minicom.patch -Patch4: minicom-2.5-man-runscript.patch +Patch1: minicom-2.5-non-readable-dir.patch +Patch2: minicom-2.5-man-minicom.patch +Patch3: minicom-2.5-man-runscript.patch %description Minicom is a simple text-based modem control and terminal emulation @@ -25,16 +24,15 @@ language, and other features. %prep %setup -q -%patch1 -p1 -b .rh -%patch2 -p1 -b .dir +%patch1 -p1 -b .dir +%patch2 -p1 -b .man %patch3 -p1 -b .man -%patch4 -p1 -b .man cp -pr doc doc_ rm -f doc_/Makefile* %build -%configure +%configure --enable-lock-dir=%{_localstatedir}/lock/lockdev make %{?_smp_mflags} %install @@ -58,6 +56,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/* %changelog +* Wed Mar 9 2011 Jan Görig 2.5-5 +- dropped rh patch because /var/lock/lockdev is now world writeable + * Thu Feb 24 2011 Jan Görig 2.5-4 - fixed crashing on device reconnecting (#678812)