Skip to content

Commit 274749c

Browse files
committed
checksum: fix binary flag on windows
1 parent cc528d1 commit 274749c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/uu/cksum/src/cksum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
186186
digest: algo.create_digest(),
187187
output_format,
188188
line_ending,
189+
binary: false,
189190
no_names: false,
190191
};
191192

src/uu/hashsum/src/hashsum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
230230
/* base64: */ false,
231231
),
232232
line_ending,
233+
binary,
233234
no_names,
234235
};
235236

src/uucore/src/lib/features/checksum/compute.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ pub struct ChecksumComputeOptions {
3434
/// Whether to finish lines with '\n' or '\0'.
3535
pub line_ending: LineEnding,
3636

37+
/// On windows, open files as binary instead of text
38+
pub binary: bool,
39+
3740
/// (non-GNU option) Do not print file names
3841
pub no_names: bool,
3942
}
@@ -290,7 +293,7 @@ where
290293
let (sum_hex, sz) = digest_reader(
291294
&mut options.digest,
292295
&mut file,
293-
false,
296+
options.binary,
294297
options.algo_kind.bitlen(),
295298
)
296299
.map_err_context(|| translate!("cksum-error-failed-to-read-input"))?;

0 commit comments

Comments
 (0)