Yeah, it works. Thanks. I will commit a slightly different version of the same idea, with explanatory comments.
kr 2009/11/26 Johan Bergström <[email protected]>: > Keith, > without knowing too much about your environment, here goes. > This is not very pretty since we now actually "care" about return > value, but does it work?!? :-) > > commit 0e5d281a6b93c781091e902441579f79d9621c2e > Author: Johan Bergström <[email protected]> > Date: Thu Nov 26 21:15:17 2009 +0100 > > Another stab at fixing ftruncate warnings. This time it gets ugly > > diff --git a/binlog.c b/binlog.c > index 377eac9..56675f8 100644 > --- a/binlog.c > +++ b/binlog.c > @@ -259,9 +259,10 @@ binlog_read_log_file(binlog b, job binlog_jobs) > static void > binlog_close(binlog b) > { > + int unused; > if (!b) return; > if (b->fd < 0) return; > - if (b->free) (void) ftruncate(b->fd, lseek(b->fd, b->free, > SEEK_END)); > + if (b->free) unused = ftruncate(b->fd, lseek(b->fd, b->free, > SEEK_END)); > close(b->fd); > b->fd = -1; > binlog_dref(b); > > > > > On Nov 25, 6:37 am, Keith Rarick <[email protected]> wrote: >> On Tue, Nov 24, 2009 at 8:51 PM, Keith Rarick <[email protected]> wrote: >> > On Tue, Nov 24, 2009 at 11:18 AM, Graham Barr <[email protected]> wrote: >> >> I agree this would be the correct fix for the compiler warnings >> >> > Will fix. >> >> I spoke too soon. Johan's patch returns me to my original state: >> >> $ make >> make all-am >> make[1]: Entering directory `/home/kr/src/beanstalkd' >> gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -Werror -I/usr/include -c -o >> binlog.o binlog.c >> cc1: warnings being treated as errors >> binlog.c: In function ‘binlog_close’: >> binlog.c:264: error: ignoring return value of ‘ftruncate’, declared >> with attribute warn_unused_result >> make[1]: *** [binlog.o] Error 1 >> make[1]: Leaving directory `/home/kr/src/beanstalkd' >> make: *** [all] Error 2 >> >> I don't know how to suppress just this instance of this warning >> without breaking the build somewhere. >> >> kr > > -- > > You received this message because you are subscribed to the Google Groups > "beanstalk-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/beanstalk-talk?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "beanstalk-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.
