From ae53b700d4f8008decf6d8b42c7000701ad509bf Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 12 Mar 2023 13:49:18 +0100 Subject: [PATCH] shred: make dependency on libc explicit --- Cargo.lock | 1 + src/uu/shred/Cargo.toml | 1 + src/uu/shred/src/shred.rs | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 4d53a4c2e..f565d5f1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3021,6 +3021,7 @@ name = "uu_shred" version = "0.0.17" dependencies = [ "clap", + "libc", "rand", "uucore", ] diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 94a741bb3..ee129122a 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -18,6 +18,7 @@ path = "src/shred.rs" clap = { workspace=true } rand = { workspace=true } uucore = { workspace=true } +libc = { workspace=true } [[bin]] name = "shred" diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 99fdc91ed..1c7d6ab13 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -9,14 +9,16 @@ // spell-checker:ignore (words) wipesync prefill use clap::{crate_version, Arg, ArgAction, Command}; +#[cfg(unix)] +use libc::S_IWUSR; use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng}; use std::fs::{self, File, OpenOptions}; use std::io::{self, Seek, Write}; +#[cfg(unix)] use std::os::unix::prelude::PermissionsExt; use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; -use uucore::libc::S_IWUSR; use uucore::{format_usage, help_about, help_section, help_usage, show, show_error, show_if_err}; const ABOUT: &str = help_about!("shred.md");