From cc88b371a5072242b76d80fae5483d1777029c71 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 29 Oct 2009 16:03:07 -0700 Subject: Fix return value of puts for very long strings. --- libio/ioputs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libio/ioputs.c') diff --git a/libio/ioputs.c b/libio/ioputs.c index 2f43e99..7fa5db5 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1996,1997,1998,1999,2003 Free Software Foundation, Inc. +/* Copyright (C) 1993,1996-1999,2003,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,6 +27,7 @@ #include "libioP.h" #include +#include int _IO_puts (str) @@ -40,7 +41,7 @@ _IO_puts (str) || _IO_fwide (_IO_stdout, -1) == -1) && _IO_sputn (_IO_stdout, str, len) == len && _IO_putc_unlocked ('\n', _IO_stdout) != EOF) - result = len + 1; + result = MIN (INT_MAX, len + 1); _IO_release_lock (_IO_stdout); return result; -- cgit v1.1