Re: [ANNOUNCE, DISCUSS] xfsprogs: libxfs-4.1-update branch created

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

 



On 5/13/15 5:14 PM, Eric Sandeen wrote:
> One interesting problem that arises from this is in xfs_format.h:
> 
> /* On-disk XFS extended attribute names */
> #define SGI_ACL_FILE            (char *)"SGI_ACL_FILE"
> #define SGI_ACL_DEFAULT         (char *)"SGI_ACL_DEFAULT"
> #define SGI_ACL_FILE_SIZE       (sizeof(SGI_ACL_FILE)-1)
> #define SGI_ACL_DEFAULT_SIZE    (sizeof(SGI_ACL_DEFAULT)-1)
> 
> (aside: why is it unsigned in the kernel but not here?)
> 
> Anyway: that "sizeof" gives us 7, because it's getting the
> size of the pointer, not the string literal.  Cool eh!
> Never mattered in the kernel, because the _SIZE macros aren't
> used.
> 
> I'm not actually sure what the cleanest way to fix this is;
> casting string literals gets way past my comfort level with
> C pedantry; technically if we want an array of unsigned chars,
> we probably need:
> 
> unsigned char *SGI_ACL_FILE[] = "SGI_ACL_FILE";
> unsigned char *SGI_ACL_DEFAULT[] = "SGI_ACL_DEFAULT";

Er, drop the * of course ...

-Eric

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux