mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-07-26 10:39:01 +02:00
(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.
This commit is contained in:
+4
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user