]>
Commit | Line | Data |
---|---|---|
6b38ee9a AF |
1 | diff -up diffutils-2.8.1/src/cmp.c.cmp-s-empty diffutils-2.8.1/src/cmp.c |
2 | --- diffutils-2.8.1/src/cmp.c.cmp-s-empty 2002-04-05 21:37:31.000000000 +0100 | |
3 | +++ diffutils-2.8.1/src/cmp.c 2010-06-25 14:56:08.464802321 +0100 | |
4 | @@ -316,12 +316,15 @@ main (int argc, char **argv) | |
5 | ||
6 | /* If only a return code is needed, | |
7 | and if both input descriptors are associated with plain files, | |
8 | + and if both files are larger than 0 bytes (procfs files are always 0), | |
9 | conclude that the files differ if they have different sizes | |
10 | and if more bytes will be compared than are in the smaller file. */ | |
11 | ||
12 | if (comparison_type == type_status | |
13 | && S_ISREG (stat_buf[0].st_mode) | |
14 | - && S_ISREG (stat_buf[1].st_mode)) | |
15 | + && S_ISREG (stat_buf[1].st_mode) | |
16 | + && stat_buf[0].st_size > 0 | |
17 | + && stat_buf[1].st_size > 0) | |
18 | { | |
19 | off_t s0 = stat_buf[0].st_size - file_position (0); | |
20 | off_t s1 = stat_buf[1].st_size - file_position (1); |