rem: sortlines (line, buf.nlines, linebase); if (buf.eof && !nfiles && !n_temp_files && !buf.left)
add: if (1 < buf.nlines) sortlines (line, buf.nlines, linebase); if (buf.eof && !nfiles && !ntemps && !buf.left)
context: sort (char **files, int nfiles, char const *output_file){  struct buffer buf;  int n_temp_files = 0;  int output_file_created = 0;  static size_t size;  if (! size && ! (size = sort_size))    size = default_sort_size ();  buf.alloc = 0;  while (nfiles)    {      char const *temp_output;      char const *file = *files;      FILE *fp = xfopen (file, "r");      FILE *tfp;      if (! buf.alloc)	initbuf (&buf, 2 * sizeof (struct line),		 sort_buffer_size (&fp, 1, files, nfiles,				   2 * sizeof (struct line), size));      buf.eof = 0;      files++;      nfiles--;      while (fillbuf (&buf, fp, file))	{	  struct line *line;	  struct line *linebase;	  if (buf.eof && nfiles	      && (2 * sizeof (struct line) + 1		  < (buf.alloc - buf.used		     - 2 * sizeof (struct line) * buf.nlines)))	    {	      /* End of file, but there is more input and buffer room.		 Concatenate the next input file; this is faster in		 the usual case.  */	      buf.left = buf.used;	      break;	    }	  line = buffer_linelim (&buf);	  linebase = line - buf.nlines;	  sortlines (line, buf.nlines, linebase);	  if (buf.eof && !nfiles && !n_temp_files && !buf.left)	    {	      xfclose (fp, file);	      tfp = xfopen (output_file, "w");	      temp_output = output_file;	      output_file_created = 1;	    }	  else	    {	      ++n_temp_files;	      temp_output = create_temp_file (&tfp);	    }	  do	    {	      line--;	      write_bytes (line->text, line->length, tfp, temp_output);	      if (unique)		while (linebase < line && compare (line, line - 1) == 0)		  line--;	    }	  while (linebase < line);	  xfclose (tfp, temp_output);	  if (output_file_created)	    goto finish;	}      xfclose (fp, file);    } finish:  free (buf.buf);  if (! output_file_created)    {      int i = n_temp_files;      struct tempnode *node;      char **tempfiles = (char **) xmalloc (n_temp_files * sizeof (char *));      for (node = temphead; i > 0; node = node->next)	tempfiles[--i] = node->name;      merge (tempfiles, n_temp_files, NMERGE, output_file);      free ((char *) tempfiles);    }}