fix for printw error

This commit is contained in:
zhang__3125 2022-03-10 16:14:23 +08:00
parent 1c2256b7f9
commit 1adcfb5d15
2 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,48 @@
diff -uNr mtr-0.94.orig/ui/curses.c mtr-0.94/ui/curses.c
--- mtr-0.94.orig/ui/curses.c 2020-09-24 16:26:14.000000000 +0800
+++ mtr-0.94/ui/curses.c 2022-03-10 15:35:51.374026715 +0800
@@ -432,7 +432,7 @@
attron(A_BOLD);
#ifdef HAVE_IPINFO
if (is_printii(ctl))
- printw(fmt_ipinfo(ctl, addr));
+ printw("%s", fmt_ipinfo(ctl, addr));
#endif
if (name != NULL) {
if (ctl->show_ips)
@@ -485,7 +485,7 @@
printw("\n ");
#ifdef HAVE_IPINFO
if (is_printii(ctl))
- printw(fmt_ipinfo(ctl, addrs));
+ printw("%s", fmt_ipinfo(ctl, addrs));
#endif
if (name != NULL) {
if (ctl->show_ips)
@@ -650,7 +650,7 @@
#ifdef HAVE_IPINFO
if (is_printii(ctl))
- printw(fmt_ipinfo(ctl, addr));
+ printw("%s", fmt_ipinfo(ctl, addr));
#endif
name = dns_lookup(ctl, addr);
printw("%s", name ? name : strlongip(ctl, addr));
@@ -700,7 +700,7 @@
mvprintw(1, 0, "%s (%s) -> %s", ctl->LocalHostname, net_localaddr(), ctl->Hostname);
t = time(NULL);
- mvprintw(1, maxx - 25, iso_time(&t));
+ mvprintw(1, maxx - 25, "%s", iso_time(&t));
printw("\n");
printw("Keys: ");
@@ -760,7 +760,7 @@
startstat = padding - 2;
snprintf(msg, sizeof(msg), " Last %3d pings", max_cols);
- mvprintw(rowstat - 1, startstat, msg);
+ mvprintw(rowstat - 1, startstat, "%s", msg);
attroff(A_BOLD);
move(rowstat, 0);

View File

@ -2,7 +2,7 @@
Name: mtr Name: mtr
Version: 0.94 Version: 0.94
Release: 2 Release: 3
Epoch: 2 Epoch: 2
Summary: Ping and Traceroute Network Diagnostic Tool Summary: Ping and Traceroute Network Diagnostic Tool
License: GPLv2 and BSD License: GPLv2 and BSD
@ -10,7 +10,7 @@ URL: https://www.bitwizard.nl/mtr/
Source0: https://github.com/traviscross/mtr/archive/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/traviscross/mtr/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: net-x%{name}.desktop Source1: net-x%{name}.desktop
Source2: mtr-gtk-pkexec-wrapper.sh Source2: mtr-gtk-pkexec-wrapper.sh
Patch0: fix_for_printw_error.patch
BuildRequires: git autoconf automake libtool ncurses-devel gtk2-devel desktop-file-utils BuildRequires: git autoconf automake libtool ncurses-devel gtk2-devel desktop-file-utils
Provides: %{name}-gtk = %{epoch}:%{version}-%{release} Provides: %{name}-gtk = %{epoch}:%{version}-%{release}
@ -25,7 +25,7 @@ and percentage for all network hops between the systems.
%package_help %package_help
%prep %prep
%autosetup -n %{name}-%{version} %autosetup -n %{name}-%{version} -p1
%build %build
export CFLAGS="%{optflags} -fPIE" export CFLAGS="%{optflags} -fPIE"
@ -68,6 +68,9 @@ make test
%{_mandir}/man8/* %{_mandir}/man8/*
%changelog %changelog
* Fri Mar 11 2022 lin.zhang <lin.zhang@turbolinux.com.cn> - 0.94-3
- add patch fix_for_printw_error.patch
* Wed Mar 3 2021 lin.zhang <lin.zhang@turbolinux.com.cn> - 0.94-2 * Wed Mar 3 2021 lin.zhang <lin.zhang@turbolinux.com.cn> - 0.94-2
- modify net-xmtr.desktop file for Xfce4 Traceroute - modify net-xmtr.desktop file for Xfce4 Traceroute