Fix compiler error for option -Werror=format-security
After ncurses upgrade to 6.3, it introduces a format-security compile error. To fix it, a format literal string is added. Reference: https://gitee.com/src-openeuler/gcc/issues/I4W7ZB Signed-off-by: Qwei <qiang.wei@suse.com> (cherry picked from commit 8f28c7fb9a82913fd4406df3fa87d47964428195)
This commit is contained in:
parent
f8e1ee0179
commit
d64ed2a346
88
0001-fix-Werror-format-security-error.patch
Normal file
88
0001-fix-Werror-format-security-error.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
Subject: fix compiler error for option -Werror=format-security
|
||||||
|
|
||||||
|
After ncurses upgrade to 6.3, it introduces a format-security
|
||||||
|
compile error.
|
||||||
|
To fix it, a format literal string is added.
|
||||||
|
|
||||||
|
Reference: https://gitee.com/src-openeuler/gcc/issues/I4W7ZB
|
||||||
|
|
||||||
|
Signed-off-by: Wei, Qiang <qiang.wei@suse.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
diff --git a/gptcurses.cc b/gptcurses.cc
|
||||||
|
index 1fbaad2..b9402cd 100644
|
||||||
|
--- a/gptcurses.cc
|
||||||
|
+++ b/gptcurses.cc
|
||||||
|
@@ -239,22 +239,22 @@ Space* GPTDataCurses::ShowSpace(int spaceNum, int lineNum) {
|
||||||
|
ClearLine(lineNum);
|
||||||
|
if (space->partNum == -1) { // space is empty
|
||||||
|
move(lineNum, 12);
|
||||||
|
- printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||||
|
+ printw("%s", BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||||
|
move(lineNum, 24);
|
||||||
|
printw("free space");
|
||||||
|
} else { // space holds a partition
|
||||||
|
move(lineNum, 3);
|
||||||
|
printw("%d", space->partNum + 1);
|
||||||
|
move(lineNum, 12);
|
||||||
|
- printw(BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||||
|
+ printw("%s", BytesToIeee((space->lastLBA - space->firstLBA + 1), blockSize).c_str());
|
||||||
|
move(lineNum, 24);
|
||||||
|
- printw(space->origPart->GetTypeName().c_str());
|
||||||
|
+ printw("%s", space->origPart->GetTypeName().c_str());
|
||||||
|
move(lineNum, 50);
|
||||||
|
#ifdef USE_UTF16
|
||||||
|
space->origPart->GetDescription().extract(0, 39, temp, 39);
|
||||||
|
printw(temp);
|
||||||
|
#else
|
||||||
|
- printw(space->origPart->GetDescription().c_str());
|
||||||
|
+ printw("%s", space->origPart->GetDescription().c_str());
|
||||||
|
#endif
|
||||||
|
} // if/else
|
||||||
|
} // if
|
||||||
|
@@ -271,10 +271,10 @@ int GPTDataCurses::DisplayParts(int selected) {
|
||||||
|
|
||||||
|
move(lineNum++, 0);
|
||||||
|
theLine = "Part. # Size Partition Type Partition Name";
|
||||||
|
- printw(theLine.c_str());
|
||||||
|
+ printw("%s", theLine.c_str());
|
||||||
|
move(lineNum++, 0);
|
||||||
|
theLine = "----------------------------------------------------------------";
|
||||||
|
- printw(theLine.c_str());
|
||||||
|
+ printw("%s", theLine.c_str());
|
||||||
|
numToShow = LINES - RESERVED_TOP - RESERVED_BOTTOM;
|
||||||
|
pageNum = selected / numToShow;
|
||||||
|
for (i = pageNum * numToShow; i <= (pageNum + 1) * numToShow - 1; i++) {
|
||||||
|
@@ -636,7 +636,7 @@ void GPTDataCurses::DisplayOptions(char selectedKey) {
|
||||||
|
} // if/else
|
||||||
|
} // for
|
||||||
|
move(LINES - 1, (COLS - optionDesc.length()) / 2);
|
||||||
|
- printw(optionDesc.c_str());
|
||||||
|
+ printw("%s", optionDesc.c_str());
|
||||||
|
currentKey = selectedKey;
|
||||||
|
} // if
|
||||||
|
} // GPTDataCurses::DisplayOptions()
|
||||||
|
@@ -748,11 +748,11 @@ void GPTDataCurses::DrawMenu(void) {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
move(0, (COLS - title.length()) / 2);
|
||||||
|
- printw(title.c_str());
|
||||||
|
+ printw("%s", title.c_str());
|
||||||
|
move(2, (COLS - drive.length()) / 2);
|
||||||
|
- printw(drive.c_str());
|
||||||
|
+ printw("%s", drive.c_str());
|
||||||
|
move(3, (COLS - size.str().length()) / 2);
|
||||||
|
- printw(size.str().c_str());
|
||||||
|
+ printw("%s", size.str().c_str());
|
||||||
|
DisplayParts(currentSpaceNum);
|
||||||
|
} // DrawMenu
|
||||||
|
|
||||||
|
@@ -802,7 +802,7 @@ void PromptToContinue(void) {
|
||||||
|
void Report(string theText) {
|
||||||
|
clear();
|
||||||
|
move(0, 0);
|
||||||
|
- printw(theText.c_str());
|
||||||
|
+ printw("%s", theText.c_str());
|
||||||
|
move(LINES - 2, (COLS - 29) / 2);
|
||||||
|
printw("Press any key to continue....");
|
||||||
|
cbreak();
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: gdisk
|
Name: gdisk
|
||||||
Version: 1.0.8
|
Version: 1.0.8
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools
|
Summary: GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: http://www.rodsbooks.com/gdisk
|
URL: http://www.rodsbooks.com/gdisk
|
||||||
@ -8,6 +8,8 @@ Source0: http://downloads.sourceforge.net/gptfdisk/gptfdisk-%{version}.tar.gz
|
|||||||
|
|
||||||
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel
|
BuildRequires:ncurses-devel util-linux-devel gcc-c++ popt-devel
|
||||||
|
|
||||||
|
Patch9000: 0001-fix-Werror-format-security-error.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools.
|
GPT fdisk(consisting of the gdisk,sgdisk,cgdisk) is a set of text-mode partitioning tools.
|
||||||
rather than on the older MBR partition tables.
|
rather than on the older MBR partition tables.
|
||||||
@ -48,6 +50,9 @@ install -Dp -m 0644 fixparts.8 %{buildroot}%{_mandir}/man8/fixparts.8
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 8 02:11:35 UTC 2022 - Qiang Wei <qiang.wei@suse.com> - 1.0.8-2
|
||||||
|
- Fix compiler error for option -Werror=format-security
|
||||||
|
|
||||||
* Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 1.0.8-1
|
* Wed Nov 17 2021 Wenchao Hao <haowenchao@huawei.com> - 1.0.8-1
|
||||||
- update to gptfdisk-1.0.8
|
- update to gptfdisk-1.0.8
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user