2018-03-05 15:54:23

by Steve Dickson

[permalink] [raw]
Subject: [PATCH] Removed -Werror=unused-result warnings.

Signed-off-by: Steve Dickson <[email protected]>
---
support/nfs/nfs_mntent.c | 3 ++-
utils/blkmapd/device-discovery.c | 6 ++++--
utils/mount/network.c | 8 ++++++--
utils/nfsd/nfssvc.c | 5 +++--
utils/statd/statd.c | 3 ++-
5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
index a2118a2..c60988a 100644
--- a/support/nfs/nfs_mntent.c
+++ b/support/nfs/nfs_mntent.c
@@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
res = fflush(mfp->mntent_fp);
if (res < 0)
/* Avoid leaving a corrupt mtab file */
- ftruncate(fileno(mfp->mntent_fp), length);
+ if (ftruncate(fileno(mfp->mntent_fp), length))
+ {/* ignore return value */};
}
return (res < 0) ? 1 : 0;
}
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index b71c949..1afc80f 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -504,9 +504,11 @@ int main(int argc, char **argv)
close(pidfd);
exit(1);
}
- ftruncate(pidfd, 0);
+ if (ftruncate(pidfd, 0) < 0)
+ BL_LOG_WARNING("ftruncate on %s failed: m\n", PID_FILE);
sprintf(pidbuf, "%d\n", getpid());
- write(pidfd, pidbuf, strlen(pidbuf));
+ if (write(pidfd, pidbuf, strlen(pidbuf)) != (ssize_t)strlen(pidbuf))
+ BL_LOG_WARNING("write on %s failed: m\n", PID_FILE);
}

signal(SIGINT, sig_die);
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 8d6e4c6..9a2c878 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -811,8 +811,12 @@ int start_statd(void)
switch (pid) {
case 0: /* child */
setgroups(0, NULL);
- setgid(0);
- setuid(0);
+ if (setgid(0) < 0)
+ nfs_error(_("%s: setgid(0) failed: %s"),
+ progname, strerror(errno));
+ if (setuid(0) < 0)
+ nfs_error(_("%s: setuid(0) failed: %s"),
+ progname, strerror(errno));
execle(START_STATD, START_STATD, NULL, envp);
exit(1);
case -1: /* error */
diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index fc36792..7923f5d 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -68,7 +68,7 @@ nfssvc_mount_nfsdfs(char *progname)
* mount nfsdfs when nfsd.ko is plugged in. So, ignore the return
* code from it and just check for the "threads" file afterward.
*/
- system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");
+ err = system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");

err = stat(NFSD_THREAD_FILE, &statbuf);
if (err == 0)
@@ -325,7 +325,8 @@ nfssvc_set_time(const char *type, const int seconds)
/* set same value for lockd */
fd = open("/proc/sys/fs/nfs/nlm_grace_period", O_WRONLY);
if (fd >= 0) {
- write(fd, nbuf, strlen(nbuf));
+ if (write(fd, nbuf, strlen(nbuf)) != (ssize_t)strlen(nbuf))
+ xlog(L_ERROR, "Unable to write nlm_grace_period : %m");
close(fd);
}
}
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 197d853..563a272 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -225,7 +225,8 @@ static void set_nlm_port(char *type, int port)
fd = open(pathbuf, O_WRONLY);
if (fd < 0 && errno == ENOENT) {
/* probably module not loaded */
- system("modprobe lockd");
+ if (system("modprobe lockd"))
+ {/* ignore return value */};
fd = open(pathbuf, O_WRONLY);
}
if (fd >= 0) {
--
2.14.3



2018-03-05 16:07:01

by Chuck Lever III

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.

Hi Steve-

> On Mar 5, 2018, at 10:54 AM, Steve Dickson <[email protected]> wrote:
>=20
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> support/nfs/nfs_mntent.c | 3 ++-
> utils/blkmapd/device-discovery.c | 6 ++++--
> utils/mount/network.c | 8 ++++++--
> utils/nfsd/nfssvc.c | 5 +++--
> utils/statd/statd.c | 3 ++-
> 5 files changed, 17 insertions(+), 8 deletions(-)
>=20
> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
> index a2118a2..c60988a 100644
> --- a/support/nfs/nfs_mntent.c
> +++ b/support/nfs/nfs_mntent.c
> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
> res =3D fflush(mfp->mntent_fp);
> if (res < 0)
> /* Avoid leaving a corrupt mtab file */
> - ftruncate(fileno(mfp->mntent_fp), length);
> + if (ftruncate(fileno(mfp->mntent_fp), length))
> + {/* ignore return value */};

Why not

(void)ftruncate(fileno(mfp->mntent_fp), length);

?


> }
> return (res < 0) ? 1 : 0;
> }
> diff --git a/utils/blkmapd/device-discovery.c =
b/utils/blkmapd/device-discovery.c
> index b71c949..1afc80f 100644
> --- a/utils/blkmapd/device-discovery.c
> +++ b/utils/blkmapd/device-discovery.c
> @@ -504,9 +504,11 @@ int main(int argc, char **argv)
> close(pidfd);
> exit(1);
> }
> - ftruncate(pidfd, 0);
> + if (ftruncate(pidfd, 0) < 0)
> + BL_LOG_WARNING("ftruncate on %s failed: m\n", =
PID_FILE);
> sprintf(pidbuf, "%d\n", getpid());
> - write(pidfd, pidbuf, strlen(pidbuf));
> + if (write(pidfd, pidbuf, strlen(pidbuf)) !=3D =
(ssize_t)strlen(pidbuf))
> + BL_LOG_WARNING("write on %s failed: m\n", =
PID_FILE);
> }
>=20
> signal(SIGINT, sig_die);
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index 8d6e4c6..9a2c878 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -811,8 +811,12 @@ int start_statd(void)
> switch (pid) {
> case 0: /* child */
> setgroups(0, NULL);
> - setgid(0);
> - setuid(0);
> + if (setgid(0) < 0)
> + nfs_error(_("%s: setgid(0) =
failed: %s"),
> + progname, =
strerror(errno));
> + if (setuid(0) < 0)
> + nfs_error(_("%s: setuid(0) =
failed: %s"),
> + progname, =
strerror(errno));
> execle(START_STATD, START_STATD, NULL, =
envp);
> exit(1);
> case -1: /* error */
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index fc36792..7923f5d 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -68,7 +68,7 @@ nfssvc_mount_nfsdfs(char *progname)
> * mount nfsdfs when nfsd.ko is plugged in. So, ignore the =
return
> * code from it and just check for the "threads" file afterward.
> */
> - system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null =
2>&1");
> + err =3D system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " =
>/dev/null 2>&1");
>=20
> err =3D stat(NFSD_THREAD_FILE, &statbuf);
> if (err =3D=3D 0)
> @@ -325,7 +325,8 @@ nfssvc_set_time(const char *type, const int =
seconds)
> /* set same value for lockd */
> fd =3D open("/proc/sys/fs/nfs/nlm_grace_period", =
O_WRONLY);
> if (fd >=3D 0) {
> - write(fd, nbuf, strlen(nbuf));
> + if (write(fd, nbuf, strlen(nbuf)) !=3D =
(ssize_t)strlen(nbuf))
> + xlog(L_ERROR, "Unable to write =
nlm_grace_period : %m");
> close(fd);
> }
> }
> diff --git a/utils/statd/statd.c b/utils/statd/statd.c
> index 197d853..563a272 100644
> --- a/utils/statd/statd.c
> +++ b/utils/statd/statd.c
> @@ -225,7 +225,8 @@ static void set_nlm_port(char *type, int port)
> fd =3D open(pathbuf, O_WRONLY);
> if (fd < 0 && errno =3D=3D ENOENT) {
> /* probably module not loaded */
> - system("modprobe lockd");
> + if (system("modprobe lockd"))
> + {/* ignore return value */};
> fd =3D open(pathbuf, O_WRONLY);
> }
> if (fd >=3D 0) {
> --=20
> 2.14.3
>=20
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever




2018-03-05 16:39:38

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.



On 03/05/2018 11:06 AM, Chuck Lever wrote:
> Hi Steve-
>
>> On Mar 5, 2018, at 10:54 AM, Steve Dickson <[email protected]> wrote:
>>
>> Signed-off-by: Steve Dickson <[email protected]>
>> ---
>> support/nfs/nfs_mntent.c | 3 ++-
>> utils/blkmapd/device-discovery.c | 6 ++++--
>> utils/mount/network.c | 8 ++++++--
>> utils/nfsd/nfssvc.c | 5 +++--
>> utils/statd/statd.c | 3 ++-
>> 5 files changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
>> index a2118a2..c60988a 100644
>> --- a/support/nfs/nfs_mntent.c
>> +++ b/support/nfs/nfs_mntent.c
>> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
>> res = fflush(mfp->mntent_fp);
>> if (res < 0)
>> /* Avoid leaving a corrupt mtab file */
>> - ftruncate(fileno(mfp->mntent_fp), length);
>> + if (ftruncate(fileno(mfp->mntent_fp), length))
>> + {/* ignore return value */};
>
> Why not
>
> (void)ftruncate(fileno(mfp->mntent_fp), length);
>
> ?
That was the first I tried and it did not work... I still got the
warning/error... If you have any better idea, I'm all hears! :-)

And more strangeness... I did not see these warning/errrors when I
compiled the upstream git tree on a Fedora 27 box but I do
see them when I take that tree and compile for an Fedora 28 rpm.

Thanks for cycles!

steved.
>
>
>> }
>> return (res < 0) ? 1 : 0;
>> }
>> diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
>> index b71c949..1afc80f 100644
>> --- a/utils/blkmapd/device-discovery.c
>> +++ b/utils/blkmapd/device-discovery.c
>> @@ -504,9 +504,11 @@ int main(int argc, char **argv)
>> close(pidfd);
>> exit(1);
>> }
>> - ftruncate(pidfd, 0);
>> + if (ftruncate(pidfd, 0) < 0)
>> + BL_LOG_WARNING("ftruncate on %s failed: m\n", PID_FILE);
>> sprintf(pidbuf, "%d\n", getpid());
>> - write(pidfd, pidbuf, strlen(pidbuf));
>> + if (write(pidfd, pidbuf, strlen(pidbuf)) != (ssize_t)strlen(pidbuf))
>> + BL_LOG_WARNING("write on %s failed: m\n", PID_FILE);
>> }
>>
>> signal(SIGINT, sig_die);
>> diff --git a/utils/mount/network.c b/utils/mount/network.c
>> index 8d6e4c6..9a2c878 100644
>> --- a/utils/mount/network.c
>> +++ b/utils/mount/network.c
>> @@ -811,8 +811,12 @@ int start_statd(void)
>> switch (pid) {
>> case 0: /* child */
>> setgroups(0, NULL);
>> - setgid(0);
>> - setuid(0);
>> + if (setgid(0) < 0)
>> + nfs_error(_("%s: setgid(0) failed: %s"),
>> + progname, strerror(errno));
>> + if (setuid(0) < 0)
>> + nfs_error(_("%s: setuid(0) failed: %s"),
>> + progname, strerror(errno));
>> execle(START_STATD, START_STATD, NULL, envp);
>> exit(1);
>> case -1: /* error */
>> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
>> index fc36792..7923f5d 100644
>> --- a/utils/nfsd/nfssvc.c
>> +++ b/utils/nfsd/nfssvc.c
>> @@ -68,7 +68,7 @@ nfssvc_mount_nfsdfs(char *progname)
>> * mount nfsdfs when nfsd.ko is plugged in. So, ignore the return
>> * code from it and just check for the "threads" file afterward.
>> */
>> - system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");
>> + err = system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");
>>
>> err = stat(NFSD_THREAD_FILE, &statbuf);
>> if (err == 0)
>> @@ -325,7 +325,8 @@ nfssvc_set_time(const char *type, const int seconds)
>> /* set same value for lockd */
>> fd = open("/proc/sys/fs/nfs/nlm_grace_period", O_WRONLY);
>> if (fd >= 0) {
>> - write(fd, nbuf, strlen(nbuf));
>> + if (write(fd, nbuf, strlen(nbuf)) != (ssize_t)strlen(nbuf))
>> + xlog(L_ERROR, "Unable to write nlm_grace_period : %m");
>> close(fd);
>> }
>> }
>> diff --git a/utils/statd/statd.c b/utils/statd/statd.c
>> index 197d853..563a272 100644
>> --- a/utils/statd/statd.c
>> +++ b/utils/statd/statd.c
>> @@ -225,7 +225,8 @@ static void set_nlm_port(char *type, int port)
>> fd = open(pathbuf, O_WRONLY);
>> if (fd < 0 && errno == ENOENT) {
>> /* probably module not loaded */
>> - system("modprobe lockd");
>> + if (system("modprobe lockd"))
>> + {/* ignore return value */};
>> fd = open(pathbuf, O_WRONLY);
>> }
>> if (fd >= 0) {
>> --
>> 2.14.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Chuck Lever
>
>
>

2018-03-05 21:53:51

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.

On Mon, Mar 05, 2018 at 10:54:20AM -0500, Steve Dickson wrote:
> Signed-off-by: Steve Dickson <[email protected]>
> ---
> support/nfs/nfs_mntent.c | 3 ++-
> utils/blkmapd/device-discovery.c | 6 ++++--
> utils/mount/network.c | 8 ++++++--
> utils/nfsd/nfssvc.c | 5 +++--
> utils/statd/statd.c | 3 ++-
> 5 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
> index a2118a2..c60988a 100644
> --- a/support/nfs/nfs_mntent.c
> +++ b/support/nfs/nfs_mntent.c
> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
> res = fflush(mfp->mntent_fp);
> if (res < 0)
> /* Avoid leaving a corrupt mtab file */
> - ftruncate(fileno(mfp->mntent_fp), length);
> + if (ftruncate(fileno(mfp->mntent_fp), length))
> + {/* ignore return value */};

Might be worth a log warning?

--b.

> }
> return (res < 0) ? 1 : 0;
> }
> diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
> index b71c949..1afc80f 100644
> --- a/utils/blkmapd/device-discovery.c
> +++ b/utils/blkmapd/device-discovery.c
> @@ -504,9 +504,11 @@ int main(int argc, char **argv)
> close(pidfd);
> exit(1);
> }
> - ftruncate(pidfd, 0);
> + if (ftruncate(pidfd, 0) < 0)
> + BL_LOG_WARNING("ftruncate on %s failed: m\n", PID_FILE);
> sprintf(pidbuf, "%d\n", getpid());
> - write(pidfd, pidbuf, strlen(pidbuf));
> + if (write(pidfd, pidbuf, strlen(pidbuf)) != (ssize_t)strlen(pidbuf))
> + BL_LOG_WARNING("write on %s failed: m\n", PID_FILE);
> }
>
> signal(SIGINT, sig_die);
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index 8d6e4c6..9a2c878 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -811,8 +811,12 @@ int start_statd(void)
> switch (pid) {
> case 0: /* child */
> setgroups(0, NULL);
> - setgid(0);
> - setuid(0);
> + if (setgid(0) < 0)
> + nfs_error(_("%s: setgid(0) failed: %s"),
> + progname, strerror(errno));
> + if (setuid(0) < 0)
> + nfs_error(_("%s: setuid(0) failed: %s"),
> + progname, strerror(errno));
> execle(START_STATD, START_STATD, NULL, envp);
> exit(1);
> case -1: /* error */
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index fc36792..7923f5d 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -68,7 +68,7 @@ nfssvc_mount_nfsdfs(char *progname)
> * mount nfsdfs when nfsd.ko is plugged in. So, ignore the return
> * code from it and just check for the "threads" file afterward.
> */
> - system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");
> + err = system("/bin/mount -t nfsd nfsd " NFSD_FS_DIR " >/dev/null 2>&1");
>
> err = stat(NFSD_THREAD_FILE, &statbuf);
> if (err == 0)
> @@ -325,7 +325,8 @@ nfssvc_set_time(const char *type, const int seconds)
> /* set same value for lockd */
> fd = open("/proc/sys/fs/nfs/nlm_grace_period", O_WRONLY);
> if (fd >= 0) {
> - write(fd, nbuf, strlen(nbuf));
> + if (write(fd, nbuf, strlen(nbuf)) != (ssize_t)strlen(nbuf))
> + xlog(L_ERROR, "Unable to write nlm_grace_period : %m");
> close(fd);
> }
> }
> diff --git a/utils/statd/statd.c b/utils/statd/statd.c
> index 197d853..563a272 100644
> --- a/utils/statd/statd.c
> +++ b/utils/statd/statd.c
> @@ -225,7 +225,8 @@ static void set_nlm_port(char *type, int port)
> fd = open(pathbuf, O_WRONLY);
> if (fd < 0 && errno == ENOENT) {
> /* probably module not loaded */
> - system("modprobe lockd");
> + if (system("modprobe lockd"))
> + {/* ignore return value */};
> fd = open(pathbuf, O_WRONLY);
> }
> if (fd >= 0) {
> --
> 2.14.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2018-03-05 22:49:27

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.



On 03/05/2018 04:53 PM, J. Bruce Fields wrote:
> On Mon, Mar 05, 2018 at 10:54:20AM -0500, Steve Dickson wrote:
>> Signed-off-by: Steve Dickson <[email protected]>
>> ---
>> support/nfs/nfs_mntent.c | 3 ++-
>> utils/blkmapd/device-discovery.c | 6 ++++--
>> utils/mount/network.c | 8 ++++++--
>> utils/nfsd/nfssvc.c | 5 +++--
>> utils/statd/statd.c | 3 ++-
>> 5 files changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
>> index a2118a2..c60988a 100644
>> --- a/support/nfs/nfs_mntent.c
>> +++ b/support/nfs/nfs_mntent.c
>> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
>> res = fflush(mfp->mntent_fp);
>> if (res < 0)
>> /* Avoid leaving a corrupt mtab file */
>> - ftruncate(fileno(mfp->mntent_fp), length);
>> + if (ftruncate(fileno(mfp->mntent_fp), length))
>> + {/* ignore return value */};
>
> Might be worth a log warning?
Yes... I thought about that. But I could not think of any meaningful
log that would help diagnose the problem... The ftruncate() is basically
cleanly up a mess..

Maybe log an error message from the fflush()?

Thanks for the review!

steved.

2018-03-06 15:33:36

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.

On Mon, Mar 05, 2018 at 05:49:26PM -0500, Steve Dickson wrote:
>
>
> On 03/05/2018 04:53 PM, J. Bruce Fields wrote:
> > On Mon, Mar 05, 2018 at 10:54:20AM -0500, Steve Dickson wrote:
> >> Signed-off-by: Steve Dickson <[email protected]>
> >> ---
> >> support/nfs/nfs_mntent.c | 3 ++-
> >> utils/blkmapd/device-discovery.c | 6 ++++--
> >> utils/mount/network.c | 8 ++++++--
> >> utils/nfsd/nfssvc.c | 5 +++--
> >> utils/statd/statd.c | 3 ++-
> >> 5 files changed, 17 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
> >> index a2118a2..c60988a 100644
> >> --- a/support/nfs/nfs_mntent.c
> >> +++ b/support/nfs/nfs_mntent.c
> >> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
> >> res = fflush(mfp->mntent_fp);
> >> if (res < 0)
> >> /* Avoid leaving a corrupt mtab file */
> >> - ftruncate(fileno(mfp->mntent_fp), length);
> >> + if (ftruncate(fileno(mfp->mntent_fp), length))
> >> + {/* ignore return value */};
> >
> > Might be worth a log warning?
> Yes... I thought about that. But I could not think of any meaningful
> log that would help diagnose the problem... The ftruncate() is basically
> cleanly up a mess..
>
> Maybe log an error message from the fflush()?

Yeah, and I admit maybe it's not worth anything specifically by the time
the ftruncate also fails.

--b.

2018-03-06 15:40:13

by Chuck Lever III

[permalink] [raw]
Subject: Re: [PATCH] Removed -Werror=unused-result warnings.



> On Mar 6, 2018, at 10:33 AM, J. Bruce Fields <[email protected]> wrote:
>
> On Mon, Mar 05, 2018 at 05:49:26PM -0500, Steve Dickson wrote:
>>
>>
>> On 03/05/2018 04:53 PM, J. Bruce Fields wrote:
>>> On Mon, Mar 05, 2018 at 10:54:20AM -0500, Steve Dickson wrote:
>>>> Signed-off-by: Steve Dickson <[email protected]>
>>>> ---
>>>> support/nfs/nfs_mntent.c | 3 ++-
>>>> utils/blkmapd/device-discovery.c | 6 ++++--
>>>> utils/mount/network.c | 8 ++++++--
>>>> utils/nfsd/nfssvc.c | 5 +++--
>>>> utils/statd/statd.c | 3 ++-
>>>> 5 files changed, 17 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/support/nfs/nfs_mntent.c b/support/nfs/nfs_mntent.c
>>>> index a2118a2..c60988a 100644
>>>> --- a/support/nfs/nfs_mntent.c
>>>> +++ b/support/nfs/nfs_mntent.c
>>>> @@ -150,7 +150,8 @@ nfs_addmntent (mntFILE *mfp, struct mntent *mnt) {
>>>> res = fflush(mfp->mntent_fp);
>>>> if (res < 0)
>>>> /* Avoid leaving a corrupt mtab file */
>>>> - ftruncate(fileno(mfp->mntent_fp), length);
>>>> + if (ftruncate(fileno(mfp->mntent_fp), length))
>>>> + {/* ignore return value */};
>>>
>>> Might be worth a log warning?
>> Yes... I thought about that. But I could not think of any meaningful
>> log that would help diagnose the problem... The ftruncate() is basically
>> cleanly up a mess..
>>
>> Maybe log an error message from the fflush()?
>
> Yeah, and I admit maybe it's not worth anything specifically by the time
> the ftruncate also fails.

Acknowledging that fact in the comment might be a good idea.

--
Chuck Lever