diff --git a/usr.bin/diff/diffreg_new.c b/usr.bin/diff/diffreg_new.c --- a/usr.bin/diff/diffreg_new.c +++ b/usr.bin/diff/diffreg_new.c @@ -15,10 +15,12 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include +#ifndef DIFF_NO_MMAP #include +#endif #include -#include #include #include @@ -266,10 +268,12 @@ diff_result_free(result); diff_data_free(&left); diff_data_free(&right); +#ifndef DIFF_NO_MMAP if (str1) munmap(str1, st1.st_size); if (str2) munmap(str2, st2.st_size); +#endif fclose(f1); fclose(f2); @@ -297,6 +301,8 @@ if (*p == MAP_FAILED) #endif *p = NULL; /* fall back on file I/O */ + if (*p == NULL) + setbuffer(f, NULL, MAXBSIZE); return f; }