[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH glibc] Add file record locking support
From: |
Svante Signell |
Subject: |
Re: [PATCH glibc] Add file record locking support |
Date: |
Thu, 08 Jan 2015 18:03:31 +0100 |
On Thu, 2015-01-08 at 16:56 +0100, Guillem Jover wrote:
> 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».
Yes you are right, no checks are made. I removed the malloc part. What
about freeing fl64 later on?
> > + 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.
Fixed! (hopefully)
Updated patch attached.
fcntl.diff
Description: Text Data