diff options
author | Jim Meyering <jim@meyering.net> | 2002-01-21 22:00:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-01-21 22:00:32 +0000 |
commit | 0199f37303fb72d0eb92e17e1817bf403783e555 (patch) | |
tree | 6a642c2ab4d47f1a52a4fef4cc6e9426e616aa9d | |
parent | 8ecf5f402d81bb5ccce570457b1aed10c23a416c (diff) | |
download | coreutils-0199f37303fb72d0eb92e17e1817bf403783e555.tar.xz |
(compare_files): Don't assume that the difference
between two size_t values can be stored in an int; this doesn't
work, for example, on 64-bit Solaris.
-rw-r--r-- | src/comm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/comm.c b/src/comm.c index 183ce35b1..568968fd1 100644 --- a/src/comm.c +++ b/src/comm.c @@ -1,5 +1,5 @@ /* comm -- compare two sorted files line by line. - Copyright (C) 86, 90, 91, 1995-2001 Free Software Foundation, Inc. + Copyright (C) 86, 90, 91, 1995-2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -186,7 +186,9 @@ compare_files (char **infiles) size_t len = min (thisline[0]->length, thisline[1]->length) - 1; order = memcmp (thisline[0]->buffer, thisline[1]->buffer, len); if (order == 0) - order = thisline[0]->length - thisline[1]->length; + order = (thisline[0]->length < thisline[1]->length + ? -1 + : thisline[0]->length != thisline[1]->length); } } |