Re: dlls/dinput/effect_linuxinput.c: Check return value of 'write'. (bug # 16413)
titon barua wrote:
--- /* we don't care about the success or failure of this call */ - write(*(This->fd), &event, sizeof(event)); + /* print errors if they occur */ + if (write(*(This->fd), &event, sizeof(event)) == -1) perror ( NULL ); What's the point of your patch? What part of the comment isn't clear to you? Also don't use perror. Wine has ERR(), WARN(), TRACE() macros for that.
Vitaliy
On Sun, Jan 4, 2009 at 4:55 PM, Vitaliy Margolen <wine-devel(a)kievinfo.com> wrote:
titon barua wrote:
--- /* we don't care about the success or failure of this call */ - write(*(This->fd), &event, sizeof(event)); + /* print errors if they occur */ + if (write(*(This->fd), &event, sizeof(event)) == -1) perror ( NULL ); What's the point of your patch? What part of the comment isn't clear to you? Also don't use perror. Wine has ERR(), WARN(), TRACE() macros for that.
Vitaliy
GCC is complaining about the ignored return value. -- -Austin
On Sun, 2009-01-04 at 20:49 -0600, Austin English wrote:
On Sun, Jan 4, 2009 at 4:55 PM, Vitaliy Margolen <wine-devel(a)kievinfo.com> wrote:
titon barua wrote:
--- /* we don't care about the success or failure of this call */ - write(*(This->fd), &event, sizeof(event)); + /* print errors if they occur */ + if (write(*(This->fd), &event, sizeof(event)) == -1) perror ( NULL ); What's the point of your patch? What part of the comment isn't clear to you? Also don't use perror. Wine has ERR(), WARN(), TRACE() macros for that.
Vitaliy
GCC is complaining about the ignored return value.
As the code says /* we dont care */ but gcc prints warnings, is it ok with just "if (write(*(This->fd), &event, sizeof(event)));" Gcc wont complain and the code is as before?
Am Montag, den 05.01.2009, 11:06 +0600 schrieb titon barua:
GCC is complaining about the ignored return value.
As the code says /* we dont care */ but gcc prints warnings, is it ok with just "if (write(*(This->fd), &event, sizeof(event)));"
Gcc wont complain and the code is as before?
what about (void)write(*(This->fd), &event, sizeof(event)); Does that work to? Seems nicer than the if. Regards, Michael Karcher
On Mon, 2009-01-05 at 08:47 +0100, Michael Karcher wrote:
Am Montag, den 05.01.2009, 11:06 +0600 schrieb titon barua:
GCC is complaining about the ignored return value.
As the code says /* we dont care */ but gcc prints warnings, is it ok with just "if (write(*(This->fd), &event, sizeof(event)));"
Gcc wont complain and the code is as before?
what about (void)write(*(This->fd), &event, sizeof(event));
Does that work to? Seems nicer than the if.
Regards, Michael Karcher Compiler warning remains.
On Mon, Jan 5, 2009 at 1:45 PM, titon barua <titanix88(a)gmail.com> wrote:
On Mon, 2009-01-05 at 08:47 +0100, Michael Karcher wrote:
Am Montag, den 05.01.2009, 11:06 +0600 schrieb titon barua:
GCC is complaining about the ignored return value.
As the code says /* we dont care */ but gcc prints warnings, is it ok with just "if (write(*(This->fd), &event, sizeof(event)));"
Gcc wont complain and the code is as before?
what about (void)write(*(This->fd), &event, sizeof(event));
Does that work to? Seems nicer than the if.
Regards, Michael Karcher Compiler warning remains.
ssize_t ignored; ... ignored = write(*(This->fd), &event, sizeof(event)); You could make the ignored variable static, maybe even global. Damjan
Vitaliy Margolen wrote:
titon barua wrote:
--- /* we don't care about the success or failure of this call */ - write(*(This->fd), &event, sizeof(event)); + /* print errors if they occur */ + if (write(*(This->fd), &event, sizeof(event)) == -1) perror ( NULL );
What's the point of your patch? What part of the comment isn't clear to you? Also don't use perror. Wine has ERR(), WARN(), TRACE() macros for that.
How about this: Titon, this code does not need to be 'fixed' as it works the way it is supposed to. Please remove this code and resubmit. I was uncertain of what Titon was trying to fix so I looked up perror and it is not needed at this point and introduces uncertainty into the code. James McKenzie
participants (6)
-
Austin English -
Damjan Jovanovic -
James McKenzie -
Michael Karcher -
titon barua -
Vitaliy Margolen