mountd: fix build error with gcc v7.2

Avoid warnings being treated as errors to solve below error:

-- snip --
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:694:35: error: '%s' directive output may be
truncated writing up to 255 bytes into a region of size 53 [-Werror=format-truncation=]
|      snprintf(tmp, 64, "/sys/block/%s/", namelist[n]->d_name);
|                                    ^~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:694:5: note: 'snprintf' output between 13 and
268 bytes into a destination of size 64
|      snprintf(tmp, 64, "/sys/block/%s/", namelist[n]->d_name);
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:748:25: error: '%s' directive output may be
truncated writing up to 63 bytes into a region of size 48 [-Werror=format-truncation=]
|     snprintf(tmp, 64, "%s%s", "/tmp/run/mountd/", q->dev);
|                          ^~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:748:4: note: 'snprintf' output between 17 and
80 bytes into a destination of size 64
|     snprintf(tmp, 64, "%s%s", "/tmp/run/mountd/", q->dev);
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:374:43: error: '%s' directive writing up to
255 bytes into a region of size 42 [-Werror=format-overflow=]
|       sprintf(tmp3, "/sys/bus/scsi/devices/%s/block:%s/", namelist[n]->d_name, dev);
|                                            ^~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:374:6: note: 'sprintf' output 31 or more bytes
(assuming 286) into a destination of size 64
|       sprintf(tmp3, "/sys/bus/scsi/devices/%s/block:%s/", namelist[n]->d_name, dev);
|       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:378:44: error: '%s' directive writing up to
255 bytes into a region of size 42 [-Werror=format-overflow=]
|        sprintf(tmp3, "/sys/bus/scsi/devices/%s/block/%s/", namelist[n]->d_name, dev);
|                                             ^~
| .../tmp_new2/work/corei7-64-montavista-linux/mountd/git-r0/git/mount.c:378:7: note: 'sprintf' output 31 or more bytes
(assuming 286) into a destination of size 64
|        sprintf(tmp3, "/sys/bus/scsi/devices/%s/block/%s/", namelist[n]->d_name, dev);
|        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: all warnings being treated as errors
-- snip --

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
This commit is contained in:
Jagadeesh Krishnanjanappa
2018-03-01 04:11:16 -08:00
committed by Khem Raj
parent 70dc5f09ba
commit 79e272ff7e

View File

@@ -22,6 +22,10 @@ SRCREV_openwrt = "${OPENWRT_SRCREV}"
S = "${WORKDIR}/git"
do_configure_prepend () {
sed -i "s:-Werror --std=gnu99:-Werror -Wno-format-truncation -Wno-format-overflow --std=gnu99:g" ${S}/CMakeLists.txt
}
do_install_append() {
install -Dm 0755 ${S}/openwrt/package/system/mountd/files/mountd.config ${D}${sysconfdir}/config/mountd
install -Dm 0755 ${S}/openwrt/package/system/mountd/files/mountd.init ${D}${sysconfdir}/init.d/mountd