projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
593d17f
)
(sort): If all the input files are empty, create an empty output file.
author
Jim Meyering
<jim@meyering.net>
Tue, 13 Mar 2001 08:48:57 +0000
(08:48 +0000)
committer
Jim Meyering
<jim@meyering.net>
Tue, 13 Mar 2001 08:48:57 +0000
(08:48 +0000)
src/sort.c
patch
|
blob
|
history
diff --git
a/src/sort.c
b/src/sort.c
index
981c97f
..
f9534a1
100644
(file)
--- a/
src/sort.c
+++ b/
src/sort.c
@@
-1866,6
+1866,7
@@
sort (char **files, int nfiles, char const *output_file)
{
struct buffer buf;
int n_temp_files = 0;
+ int output_file_created = 0;
buf.alloc = 0;
@@
-1909,6
+1910,7
@@
sort (char **files, int nfiles, char const *output_file)
xfclose (fp, file);
tfp = xfopen (output_file, "w");
temp_output = output_file;
+ output_file_created = 1;
}
else
{
@@
-1928,7
+1930,7
@@
sort (char **files, int nfiles, char const *output_file)
xfclose (tfp, temp_output);
- if (
! n_temp_files
)
+ if (
output_file_created
)
goto finish;
}
xfclose (fp, file);
@@
-1937,7
+1939,7
@@
sort (char **files, int nfiles, char const *output_file)
finish:
free (buf.buf);
- if (
n_temp_files
)
+ if (
! output_file_created
)
{
int i = n_temp_files;
struct tempnode *node;