[CRIU] [PATCH] util: don't ignore chdir(/) return value
Ruslan Kuprieiev
kupruser at gmail.com
Sat Feb 1 17:52:39 PST 2014
Lost comment:
make failed with this error:
"util.c:597:8: error: ignoring return value of ‘chdir’, declared with
attribute warn_unused_result [-Werror=unused-result]
chdir("/");"
On 02.02.2014 05:49, Ruslan Kuprieiev wrote:
> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> ---
> util.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/util.c b/util.c
> index 32a61b3..d98f61f 100644
> --- a/util.c
> +++ b/util.c
> @@ -593,8 +593,11 @@ int cr_daemon(int nochdir, int noclose)
> return pid;
>
> setsid();
> - if (!nochdir)
> - chdir("/");
> + if (!nochdir) {
> + if (chdir("/"))
> + pr_perror("Can't chdir to /");
> + return -1;
> + }
> if (!noclose) {
> int fd;
>
More information about the CRIU
mailing list