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

Re: [PATCH glibc] Add file record locking support



On Thu, 2015-01-08 at 12:40:12 +0100, Svante Signell wrote:
> Index: glibc-2.19/sysdeps/mach/hurd/fcntl.c
> ===================================================================
> --- glibc-2.19.orig/sysdeps/mach/hurd/fcntl.c
> +++ glibc-2.19/sysdeps/mach/hurd/fcntl.c
> @@ -128,56 +127,87 @@ __libc_fcntl (int fd, int cmd, ...)
>      case F_SETLK:
>      case F_SETLKW:
>        {
[…]
>  	struct flock *fl = va_arg (ap, struct flock *);
[…]
> +	struct flock64 *fl64 = malloc (sizeof (struct flock64));

You are not checking if malloc failed, but in any case there's no need
at all to malloc the struct, just use «struct flock64 fl64».

> +        switch (fl->l_whence)
> +          {
> +          case SEEK_SET:
> +          case SEEK_CUR:
> +          case SEEK_END:
> +	    break;
> +          default:
> +            errno = EINVAL;
> +            return -1;
> +	    break;
> +	  }

The indentation here and in previous places seems messed up, check for
space vs tab and similar.

Thanks,
Guillem


Reply to: