This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]