This is the mail archive of the
mailing list for the binutils project.
Re: [Bug-readline] [PATCH] readline/histfile.c: Check and retry write() operation in history_truncate_file()
- From: Chet Ramey <chet dot ramey at case dot edu>
- To: Chen Gang <gang dot chen dot 5i5j at gmail dot com>, Andreas Schwab <schwab at linux-m68k dot org>
- Cc: chet dot ramey at case dot edu, palves at redhat dot com, gdb-patches at sourceware dot org, binutils at sourceware dot org, bug-readline at gnu dot org, amodra at gmail dot com
- Date: Wed, 18 Jun 2014 16:33:14 -0400
- Subject: Re: [Bug-readline] [PATCH] readline/histfile.c: Check and retry write() operation in history_truncate_file()
- Authentication-results: sourceware.org; auth=none
- References: <5397C077 dot 1080702 at gmail dot com>
- Reply-to: chet dot ramey at case dot edu
On 6/10/14, 10:35 PM, Chen Gang wrote:
> For regular file, write() operation may also fail, so check it too. If
> write() return 0, can simply wait and try again, it should not suspend
> infinitely if environments have no critical issues.
Readline-6.3 checks the return value from write() and returns a non-zero
value to the history_truncate_file caller. I really don't think that
waiting forever if write continues to return 0 is a great idea; an error
return is enough to let the caller deal with it.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU firstname.lastname@example.org http://cnswww.cns.cwru.edu/~chet/