[PATCH] statfs: don't quote f_type macro names
Dmitry V. Levin
ldv at altlinux.org
Mon Apr 25 00:17:09 UTC 2016
Hi,
On Sun, Apr 24, 2016 at 06:52:44PM -0500, Zev Weiss wrote:
> Hello,
>
> I noticed recently that strace puts quotes around the f_type member of
> struct statfs:
>
> statfs(".", {f_type="EXT2_SUPER_MAGIC", ...}) = 0
>
> The double-quotes seem to predate git history; ChangeLog-CVS indicates
> they were added intentionally in a commit from Rick Sladkey in 1995
> ("Enclose string result in double quotes"), though I don't see any
> reasoning as to why this was done. Given that strace's output format
> generally seems to aim for an approximate resemblance to C source code,
> it seems like f_type's value would be better off without quotes (since
> it's just a macro, not a string). Unless there's some more subtle
> reason for the current formatting that I'm not seeing, could the
> attached patch be applied to remove them?
I agree, macro name shouldn't be quoted.
> @@ -45,7 +45,7 @@ sprintfstype(const unsigned int magic)
>
> s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic);
> if (s) {
> - sprintf(buf, "\"%s\"", s);
> + sprintf(buf, "%s", s);
I think this sprintf is not needed, sprintfstype can just return s.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160425/82beffbb/attachment.bin>
More information about the Strace-devel
mailing list