Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
minicom.import5069
minicom-2.4-lockdev.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File minicom-2.4-lockdev.diff of Package minicom.import5069
Index: minicom-2.5/src/main.c =================================================================== --- minicom-2.5.orig/src/main.c +++ minicom-2.5/src/main.c @@ -164,6 +164,18 @@ int open_term(int doinit, int show_win_o int s_errno; #endif +#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; + } +#endif + + if (portfd_is_socket) + goto nolock; + +#if !HAVE_LOCKDEV /* First see if the lock file directory is present. */ if (P_LOCK[0] && stat(P_LOCK, &stt) == 0) { @@ -211,10 +223,12 @@ int open_term(int doinit, int show_win_o return -1; } } +#endif - if (doinit > 0) - lockfile_create(); + if (doinit > 0 && lockfile_create() != 0) + return -1; +nolock: /* Run a special program to disable callin if needed. */ if (doinit > 0 && P_CALLOUT[0]) { if (fastsystem(P_CALLOUT, NULL, NULL, NULL) < 0) { @@ -232,11 +246,7 @@ int open_term(int doinit, int show_win_o 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; - + if (portfd_is_socket) { portfd_sock_addr.sun_family = AF_UNIX; strncpy(portfd_sock_addr.sun_path, dial_tty + strlen(SOCKET_PREFIX), Index: minicom-2.5/src/minicom.c =================================================================== --- minicom-2.5.orig/src/minicom.c +++ minicom-2.5/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]) Index: minicom-2.5/src/minicom.h =================================================================== --- minicom-2.5.orig/src/minicom.h +++ minicom-2.5/src/minicom.h @@ -35,6 +35,10 @@ #include <time.h> +#if HAVE_LOCKDEV +#include <ttylock.h> +#endif + #ifdef USE_SOCKET #include <sys/socket.h> #include <sys/un.h> @@ -294,7 +298,7 @@ extern int io_pending, pendingkeys; void domacros(void); -void lockfile_create(void); +int lockfile_create(void); void lockfile_remove(void); Index: minicom-2.5/src/updown.c =================================================================== --- minicom-2.5.orig/src/updown.c +++ minicom-2.5/src/updown.c @@ -29,6 +29,8 @@ #include <config.h> #endif +#include <wchar.h> + #include "port.h" #include "minicom.h" #include "intl.h" @@ -457,16 +459,31 @@ void updown(int what, int nr) void lockfile_remove(void) { + if (portfd_is_socket) + return; + +#if !HAVE_LOCKDEV if (lockfile[0]) unlink(lockfile); +#else + ttyunlock(dial_tty); +#endif } -void lockfile_create(void) +int lockfile_create(void) { - int fd, n; + int n; +#if !HAVE_LOCKDEV + int fd; + char buf[81]; +#endif + + if (portfd_is_socket) + return 0; +#if !HAVE_LOCKDEV if (!lockfile[0]) - return; + return 0; n = umask(022); /* Create lockfile compatible with UUCP-1.2 */ @@ -484,6 +501,16 @@ void lockfile_create(void) close(fd); } umask(n); + return 0; +#else + n = ttylock(dial_tty); + if (n < 0) { + fprintf(stderr, _("Cannot create lockfile for %s: %s\n"), dial_tty, strerror(-n)); + } else if (n > 0) { + fprintf(stderr, _("Device %s is locked.\n"), dial_tty); + } + return n; +#endif } /* Index: minicom-2.5/configure.in =================================================================== --- minicom-2.5.orig/configure.in +++ minicom-2.5/configure.in @@ -38,6 +38,11 @@ if test "x$enable_socket" = xyes; then AC_DEFINE(USE_SOCKET, [1], [Socket support is enabled]) fi +PKG_PROG_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES([LOCKDEV], [lockdev], AC_DEFINE([HAVE_LOCKDEV],[1],[Define if you have lockdev]),[:]) +fi + AC_ARG_ENABLE([lock-dir], AS_HELP_STRING([--enable-lock-dir=DIR], [Set com line lock directory (def: try common locations)]), Index: minicom-2.5/src/Makefile.am =================================================================== --- minicom-2.5.orig/src/Makefile.am +++ minicom-2.5/src/Makefile.am @@ -29,7 +29,7 @@ confdir = @MINICOM_CONFDIR@ AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/lib -DCONFDIR=\"$(confdir)\" \ -DLOCALEDIR=\"$(datadir)/locale\" -minicom_LDADD = @LIBINTL@ $(MINICOM_LIBPORT) +minicom_LDADD = @LIBINTL@ $(MINICOM_LIBPORT) $(LOCKDEV_LIBS) minicom_keyserv_LDADD = @LIBINTL@ $(MINICOM_LIBPORT) runscript_LDADD = @LIBINTL@ $(MINICOM_LIBPORT)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor