[PATCH] statfs: don't quote f_type macro names
Zev Weiss
zev at bewilderbeest.net
Mon Apr 25 00:28:35 UTC 2016
On Mon, Apr 25, 2016 at 03:17:09AM +0300, Dmitry V. Levin wrote:
>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.
>
Ah, good point -- it *does* become pretty superfluous then. Amended
patch attached.
Zev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-statfs-don-t-quote-f_type-macro-names.patch
Type: text/x-diff
Size: 1529 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160424/72e24bf6/attachment.bin>
More information about the Strace-devel
mailing list