commit b19b3e0682d6e224c12b35308772114fe27372fe
parent 2deda8e0d1f7a58f6468d31e0202d63bfbd3b99e
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Thu, 18 Dec 2014 02:58:35 +0000
Fix timed_getlnmax: correctly update w
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libunixonacid/timed_getlnmax.c b/src/libunixonacid/timed_getlnmax.c
@@ -28,6 +28,8 @@ static int get (struct blah_s *blah)
int timed_getlnmax (buffer *b, char *d, unsigned int max, unsigned int *w, char sep, tain_t const *deadline, tain_t *stamp)
{
- struct blah_s blah = { .b = b, .d = d, .max = max, .w = 0, .sep = sep } ;
- return timed_get(&blah, (initfunc_t_ref)&getfd, (initfunc_t_ref)&get, deadline, stamp) ;
+ struct blah_s blah = { .b = b, .d = d, .max = max, .w = *w, .sep = sep } ;
+ register int r = timed_get(&blah, (initfunc_t_ref)&getfd, (initfunc_t_ref)&get, deadline, stamp) ;
+ *w = blah.w ;
+ return r ;
}