WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
65311
[EFL] Replace strerror with strerror_r.
https://bugs.webkit.org/show_bug.cgi?id=65311
Summary
[EFL] Replace strerror with strerror_r.
KwangHyuk
Reported
2011-07-28 05:35:25 PDT
As strerror_r is a thread safty api corresponding to strerror, strerror_r is more desirable for the error logging.
Attachments
Patch
(1.50 KB, patch)
2011-07-28 05:35 PDT
,
KwangHyuk
no flags
Details
Formatted Diff
Diff
Patch
(1.50 KB, patch)
2011-07-28 05:40 PDT
,
KwangHyuk
lucas.de.marchi
: review-
lucas.de.marchi
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
KwangHyuk
Comment 1
2011-07-28 05:35:55 PDT
Created
attachment 102246
[details]
Patch
WebKit Review Bot
Comment 2
2011-07-28 05:37:40 PDT
Attachment 102246
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit/efl/ChangeLog', u'Source/Web..." exit_code: 1 Source/WebKit/efl/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
KwangHyuk
Comment 3
2011-07-28 05:40:28 PDT
Created
attachment 102247
[details]
Patch
Raphael Kubo da Costa (:rakuco)
Comment 4
2011-07-28 06:19:44 PDT
Did you actually experience some problem caused by the use of strerror instead of strerror_r?
KwangHyuk
Comment 5
2011-07-28 17:38:38 PDT
> Did you actually experience some problem caused by the use of strerror instead of strerror_r?
No, in fact, it was just reported by our static analysis tool for the secure coding. But, I think webkit efl should be thread safe and secure as much as possible.
Raphael Kubo da Costa (:rakuco)
Comment 6
2011-08-01 05:40:55 PDT
Personally, I don't see this as being really needed, it looks like a change for the change's sake: strerror_r would be useful if you actually used the string it stores in buf; if you use it the same way you use strerror there shouldn't be any difference. For this use case here, I think there is no need for this patch.
Lucas De Marchi
Comment 7
2011-08-01 07:41:08 PDT
Comment on
attachment 102247
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=102247&action=review
> Source/WebKit/efl/ewk/ewk_tiled_private.h:35 > +#define OOM(op, size) \ > + char buf[256]; \ > + CRITICAL("could not %s %zd bytes: %s", op, size, strerror_r(errno, buf, sizeof(buf))) > +
Besides what Raphael said, this is wrong. See this piece of code: int function(void) { char *buf; buf = malloc(200); if (!buf) OOM("allocate", 200); } Bang... you get a compiler error: `error: expected expression before ‘char’'
Lucas De Marchi
Comment 8
2011-08-01 07:45:38 PDT
(In reply to
comment #7
)
> (From update of
attachment 102247
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=102247&action=review
> > > Source/WebKit/efl/ewk/ewk_tiled_private.h:35 > > +#define OOM(op, size) \ > > + char buf[256]; \ > > + CRITICAL("could not %s %zd bytes: %s", op, size, strerror_r(errno, buf, sizeof(buf))) > > +
A patch worth doing would be to change this message to use "%m" instead of strerror() -- and removing "#include <errno.h>" where possible.
Lucas De Marchi
Comment 9
2011-08-01 10:26:22 PDT
(In reply to
comment #8
)
> (In reply to
comment #7
) > > (From update of
attachment 102247
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=102247&action=review
> > > > > Source/WebKit/efl/ewk/ewk_tiled_private.h:35 > > > +#define OOM(op, size) \ > > > + char buf[256]; \ > > > + CRITICAL("could not %s %zd bytes: %s", op, size, strerror_r(errno, buf, sizeof(buf))) > > > + > > > A patch worth doing would be to change this message to use "%m" instead of strerror() -- and removing "#include <errno.h>" where possible.
Ahnn... this is true if we don't mind to support a libc other than glibc. Otherwise it should remain as is.
KwangHyuk
Comment 10
2011-08-08 01:04:49 PDT
> Ahnn... this is true if we don't mind to support a libc other than glibc. > Otherwise it should remain as is.
Thank you for your detail idea, "%m" looks good to me too because glic's printf seems to use strerror_r. And printf will ignore "%m" if it will not available.
Raphael Kubo da Costa (:rakuco)
Comment 11
2011-08-08 05:33:45 PDT
(In reply to
comment #10
)
> > Ahnn... this is true if we don't mind to support a libc other than glibc. > > Otherwise it should remain as is. > > Thank you for your detail idea, > > "%m" looks good to me too because glic's printf seems to use strerror_r. > And printf will ignore "%m" if it will not available.
No, %m is not portable and should not be used. I don't think we only have glibc in mind. IMO, the bug should be closed.
KwangHyuk
Comment 12
2011-08-10 18:34:49 PDT
> IMO, the bug should be closed.
Ok. Then, I better close this.
KwangHyuk
Comment 13
2011-08-16 09:07:26 PDT
I agree to close this bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug