[PATCH] hurd: Fix F_*LK* fcntl with __USE_FILE_OFFSET64

Roland McGrath roland@hack.frob.com
Sun Feb 8 02:20:00 GMT 2015


> +# define	F_GETLK		7	/* Get record locking info.  */
> +# define	F_SETLK		8	/* Set record locking info (non-blocking).  */
> +# define	F_SETLKW	9	/* Set record locking info (blocking).  */
> +#endif
> +#define	F_GETLK64	10	/* Get record locking info.  */
> +#define	F_SETLK64	11	/* Set record locking info (non-blocking).  */
> +#define	F_SETLKW64	12	/* Set record locking info (blocking).  */

Do these values match up with any other system's values?
i.e., if most of our values already match Linux or some BSD subset,
then for new arbitrary values, we pick the ones that match the same thing.

> +{
> +  int cmd;
> +
> +  switch (type)
> +    {
> +    case F_RDLCK: cmd |= LOCK_SH; break;
> +    case F_WRLCK: cmd |= LOCK_EX; break;

Uses CMD uninitialized.  The equivalent to the original code
in __fcntl is to initialize CMD to zero here.

I would have thought the compiler would catch that.  Have you tested this
patch on current trunk libc?  Are you using --disable-werror for some reason?
If you are, then let's work on resolving those outstanding warnings ASAP.


Thanks,
Roland



More information about the Libc-alpha mailing list