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. */
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)
lockfile_create();
@ -40,21 +40,24 @@ index bc4db89..8e68e2c 100644
+ rc = 0;
+ } else {
+ rc = 1;
+ fprintf(stderr, _("File %s is not a socket.\n"),
+ if (!no_msgs)
+ fprintf(stderr, _("File %s is not a socket.\n"),
+ dial_tty+strlen(SOCKET_PREFIX));
+ }
+ } else {
+#endif
+ 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);
+ 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
+ }
@ -62,7 +65,7 @@ index bc4db89..8e68e2c 100644
+ if (rc == 0) {
+ snprintf(lockfile, sizeof(lockfile), "%s", dial_tty);
+ } else {
+ if (stdwin) mc_wclose(stdwin, 1);
+ if (!no_msgs && stdwin) mc_wclose(stdwin, 1);
+ return(-1);
+ }
+ }

View File

@ -1,7 +1,7 @@
Summary: A text-based modem control and terminal emulation program
Name: minicom
Version: 2.5
Release: 3%{?dist}
Release: 4%{?dist}
URL: http://alioth.debian.org/projects/minicom/
License: GPLv2+
Group: Applications/Communications
@ -58,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/*
%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
- fixed crashing on non-readable directory (#675400)
- fixed typos in minicom and runscript manpages (#675453,#675456)