fixed crashing on device reconnecting (#678812)

This commit is contained in:
Jan Görig 2011-02-24 12:13:34 +01:00
parent ada5b9e1ae
commit be44cb9976
2 changed files with 19 additions and 13 deletions

View File

@ -26,7 +26,7 @@ index bc4db89..8e68e2c 100644
/* First see if the lock file directory is present. */ /* First see if the lock file directory is present. */
if (P_LOCK[0] && stat(P_LOCK, &stt) == 0) { if (P_LOCK[0] && stat(P_LOCK, &stt) == 0) {
@@ -215,6 +221,44 @@ int open_term(int doinit, int show_win_on_error, int no_msgs) @@ -215,6 +221,47 @@ int open_term(int doinit, int show_win_on_error, int no_msgs)
if (doinit > 0) if (doinit > 0)
lockfile_create(); lockfile_create();
@ -40,12 +40,14 @@ index bc4db89..8e68e2c 100644
+ rc = 0; + rc = 0;
+ } else { + } else {
+ rc = 1; + rc = 1;
+ if (!no_msgs)
+ fprintf(stderr, _("File %s is not a socket.\n"), + fprintf(stderr, _("File %s is not a socket.\n"),
+ dial_tty+strlen(SOCKET_PREFIX)); + dial_tty+strlen(SOCKET_PREFIX));
+ } + }
+ } else { + } else {
+#endif +#endif
+ rc = ttylock(dial_tty); + rc = ttylock(dial_tty);
+ if(!no_msgs) {
+ if (rc < 0) { + if (rc < 0) {
+ if (access(dial_tty, W_OK) == -1) + if (access(dial_tty, W_OK) == -1)
+ fprintf(stderr, _("Device %s access failed: %s.\n"), + fprintf(stderr, _("Device %s access failed: %s.\n"),
@ -56,13 +58,14 @@ index bc4db89..8e68e2c 100644
+ } else if (rc > 0) { + } else if (rc > 0) {
+ fprintf(stderr, _("Device %s is locked.\n"), dial_tty); + fprintf(stderr, _("Device %s is locked.\n"), dial_tty);
+ } + }
+ }
+#ifdef USE_SOCKET +#ifdef USE_SOCKET
+ } + }
+#endif +#endif
+ if (rc == 0) { + if (rc == 0) {
+ snprintf(lockfile, sizeof(lockfile), "%s", dial_tty); + snprintf(lockfile, sizeof(lockfile), "%s", dial_tty);
+ } else { + } else {
+ if (stdwin) mc_wclose(stdwin, 1); + if (!no_msgs && stdwin) mc_wclose(stdwin, 1);
+ return(-1); + return(-1);
+ } + }
+ } + }

View File

@ -1,7 +1,7 @@
Summary: A text-based modem control and terminal emulation program Summary: A text-based modem control and terminal emulation program
Name: minicom Name: minicom
Version: 2.5 Version: 2.5
Release: 3%{?dist} Release: 4%{?dist}
URL: http://alioth.debian.org/projects/minicom/ URL: http://alioth.debian.org/projects/minicom/
License: GPLv2+ License: GPLv2+
Group: Applications/Communications Group: Applications/Communications
@ -58,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Thu Feb 24 2011 Jan Görig <jgorig@redhat.com> 2.5-4
- fixed crashing on device reconnecting (#678812)
* Wed Feb 09 2011 Jan Görig <jgorig@redhat.com> 2.5-3 * Wed Feb 09 2011 Jan Görig <jgorig@redhat.com> 2.5-3
- fixed crashing on non-readable directory (#675400) - fixed crashing on non-readable directory (#675400)
- fixed typos in minicom and runscript manpages (#675453,#675456) - fixed typos in minicom and runscript manpages (#675453,#675456)