I see a useless use of cat in here. Manual page: When called with the -d option, it must decompress standard input to standard output.
Index: file.c =================================================================== RCS file: /cvs/src/usr.bin/sort/file.c,v retrieving revision 1.4 diff -u -p -u -p -r1.4 file.c --- file.c 30 Mar 2015 19:59:07 -0000 1.4 +++ file.c 31 Mar 2015 18:35:01 -0000 @@ -526,8 +526,8 @@ openfile(const char *fn, const char *mod fflush(stdout); if (mode[0] == 'r') - len = sort_asprintf(&cmd, "cat %s | %s -d", - fn, compress_program); + len = sort_asprintf(&cmd, "%s -d < %s", + compress_program, fn); else if (mode[0] == 'w') len = sort_asprintf(&cmd, "%s > %s", compress_program, fn);