summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-11-20 10:56:57 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-11-20 10:56:57 -0800
commit7b6371b9d35705ee3800082ca245f8dd289bb216 (patch)
tree5d808dfc73a2d40fdf9572bd323b406fbfc833e2
parentbf6230baa909cd66455abd83b81f97d692f3456f (diff)
downloadnasm-7b6371b9d35705ee3800082ca245f8dd289bb216.tar.gz
BR 3392529: if the default output name is the same as input -> nasm.out
If no output filename is specified, then a default filename is used based on the input filename. If that ends up the *same* as the input filename, change the output filename to "nasm.out". Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/nasm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index bf0720a3..41a26649 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -514,9 +514,14 @@ int main(int argc, char **argv)
* is a preprocess mode, we're perfectly
* fine to output into stdout.
*/
- if (!outname) {
- if (!(operating_mode & OP_PREPROCESS))
- outname = filename_set_extension(inname, ofmt->extension);
+ if (!outname && !(operating_mode & OP_PREPROCESS)) {
+ outname = filename_set_extension(inname, ofmt->extension);
+ if (!strcmp(outname, inname)) {
+ outname = "nasm.out";
+ nasm_error(ERR_WARNING,
+ "default output file same as input, using `%s' for output\n",
+ inname, outname);
+ }
}
depend_ptr = (depend_file || (operating_mode & OP_DEPEND))