diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2021-06-07 15:21:01 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2021-06-07 15:21:01 +0000 |
commit | 30363466e3580cae5f428c9bf35caa934cef469b (patch) | |
tree | 265f9bd6b4a8ebcf7102908ca0596dc1f42ce28a /src/sgm_dd.c | |
parent | d65eadbdaa302c7b83c059569a28efd3304947e4 (diff) | |
download | sg3_utils-30363466e3580cae5f428c9bf35caa934cef469b.tar.gz |
sg_vpd: fix do_hex type on some recent pages; sg_dd: don't close negative file descriptors; pt_linux_nvme: fix fua setting
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@903 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sgm_dd.c')
-rw-r--r-- | src/sgm_dd.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sgm_dd.c b/src/sgm_dd.c index b01d694b..d4e2ce16 100644 --- a/src/sgm_dd.c +++ b/src/sgm_dd.c @@ -1,7 +1,7 @@ /* A utility program for copying files. Specialised for "files" that * represent devices that understand the SCSI command set. * - * Copyright (C) 1999 - 2020 D. Gilbert and P. Allworth + * Copyright (C) 1999 - 2021 D. Gilbert and P. Allworth * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -69,7 +69,7 @@ #include "sg_pr2serr.h" -static const char * version_str = "1.67 20200510"; +static const char * version_str = "1.68 20210601"; #define DEF_BLOCK_SIZE 512 #define DEF_BLOCKS_PER_TRANSFER 128 @@ -1442,10 +1442,12 @@ main(int argc, char * argv[]) fini: if (wrkBuff) free(wrkBuff); - if (STDIN_FILENO != infd) + if ((STDIN_FILENO != infd) && (infd >= 0)) close(infd); - if ((STDOUT_FILENO != outfd) && (FT_DEV_NULL != out_type)) - close(outfd); + if ((STDOUT_FILENO != outfd) && (FT_DEV_NULL != out_type)) { + if (outfd >= 0) + close(outfd); + } if ((0 != dd_count) && (0 == dry_run)) { pr2serr("Some error occurred,"); if (0 == ret) |