diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:47:02 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:47:02 +0300 |
commit | 315bd501ca696bc3e3c938b4604d8dac7a6f512f (patch) | |
tree | cf992f0df002126292f7487ca6c0d36d7fe748b9 /extension/filefuncs.c | |
parent | 85c0d5edb781c9f31b79e48452b1ca68643f41de (diff) | |
download | egawk-315bd501ca696bc3e3c938b4604d8dac7a6f512f.tar.gz egawk-315bd501ca696bc3e3c938b4604d8dac7a6f512f.tar.bz2 egawk-315bd501ca696bc3e3c938b4604d8dac7a6f512f.zip |
Move to gawk 3.1.5.
Diffstat (limited to 'extension/filefuncs.c')
-rw-r--r-- | extension/filefuncs.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/extension/filefuncs.c b/extension/filefuncs.c index ed86875a..f719f32d 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2001, 2004 the Free Software Foundation, Inc. + * Copyright (C) 2001, 2004, 2005 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -24,7 +24,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "awk.h" @@ -260,14 +260,16 @@ NODE *tree; char buf[BUFSIZ*2]; int linksize; - linksize = readlink(file->stptr, buf, sizeof buf); - /* should make this smarter */ - if (linksize == sizeof(buf)) - fatal("size of symbolic link too big"); - buf[linksize] = '\0'; + linksize = readlink(file->stptr, buf, sizeof(buf) - 1); + if (linksize >= 0) { + /* should make this smarter */ + if (linksize >= sizeof(buf) - 1) + fatal("size of symbolic link too big"); + buf[linksize] = '\0'; - aptr = assoc_lookup(array, tmp_string("linkval", 7), FALSE); - *aptr = make_string(buf, linksize); + aptr = assoc_lookup(array, tmp_string("linkval", 7), FALSE); + *aptr = make_string(buf, linksize); + } } /* add a type field */ |