bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] avoid stat/fstat in statvfs/fstatvfs


From: Roland McGrath
Subject: Re: [PATCH] avoid stat/fstat in statvfs/fstatvfs
Date: Thu, 7 Feb 2013 12:46:28 -0800 (PST)

The substance of the change seems fine.  It needs a proper ChangeLog entry.
See the glibc wiki for full instructions on posting patches.

> +  struct stat64 st;
> +  int r = fd >= 0 ? fstat64(fd, &st) : stat64(name, &st);

Put space before paren in those calls.
It's shorter and more common to invert the sense and use < 0.

> +  if (r == -1)
>      return 0;

There is no need for a variable here.
Also, it's more usual to test for failure with < 0:

        if ((fd < 0 ? stat64 (name, &st) : fstat64 (fd, &st)) < 0)
          return 0;


Thanks,
Roland



reply via email to

[Prev in Thread] Current Thread [Next in Thread]