projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow output files to overwrite input files (bug #21280). Thanks to
[pspp]
/
src
/
language
/
data-io
/
data-list.c
diff --git
a/src/language/data-io/data-list.c
b/src/language/data-io/data-list.c
index 6ca829fc5ab7d75d5459c58d1d828436cc5d5c3c..3ee524d5b80001b7ad7e7c81eb3e0d206f5dd48b 100644
(file)
--- a/
src/language/data-io/data-list.c
+++ b/
src/language/data-io/data-list.c
@@
-120,7
+120,7
@@
cmd_data_list (struct lexer *lexer, struct dataset *ds)
struct dictionary *dict;
struct data_list_pgm *dls;
int table = -1; /* Print table if nonzero, -1=undecided. */
struct dictionary *dict;
struct data_list_pgm *dls;
int table = -1; /* Print table if nonzero, -1=undecided. */
- struct file_handle *fh =
fh_inline_file ()
;
+ struct file_handle *fh =
NULL
;
struct pool *tmp_pool;
bool ok;
struct pool *tmp_pool;
bool ok;
@@
-143,6
+143,7
@@
cmd_data_list (struct lexer *lexer, struct dataset *ds)
if (lex_match_id (lexer, "FILE"))
{
lex_match (lexer, '=');
if (lex_match_id (lexer, "FILE"))
{
lex_match (lexer, '=');
+ fh_unref (fh);
fh = fh_parse (lexer, FH_REF_FILE | FH_REF_INLINE);
if (fh == NULL)
goto error;
fh = fh_parse (lexer, FH_REF_FILE | FH_REF_INLINE);
if (fh == NULL)
goto error;
@@
-244,6
+245,8
@@
cmd_data_list (struct lexer *lexer, struct dataset *ds)
}
}
}
}
+ if (fh == NULL)
+ fh = fh_inline_file ();
fh_set_default_handle (fh);
if (dls->type == -1)
fh_set_default_handle (fh);
if (dls->type == -1)
@@
-292,10
+295,12
@@
cmd_data_list (struct lexer *lexer, struct dataset *ds)
}
pool_destroy (tmp_pool);
}
pool_destroy (tmp_pool);
+ fh_unref (fh);
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
+ fh_unref (fh);
data_list_trns_free (dls);
return CMD_CASCADING_FAILURE;
}
data_list_trns_free (dls);
return CMD_CASCADING_FAILURE;
}