cp: fix recursive socket file copy

This commit is contained in:
Anonymous-AAA
2025-08-13 08:25:34 +05:30
parent 005ccccddf
commit bfbdf10d3f
3 changed files with 62 additions and 5 deletions
+10 -1
View File
@@ -3,7 +3,7 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//spell-checker: ignore (linux) rlimit prlimit coreutil ggroups uchild uncaptured scmd SHLVL canonicalized openpty
//spell-checker: ignore (linux) winsize xpixel ypixel setrlimit FSIZE SIGBUS SIGSEGV sigbus tmpfs
//spell-checker: ignore (linux) winsize xpixel ypixel setrlimit FSIZE SIGBUS SIGSEGV sigbus tmpfs mksocket
#![allow(dead_code)]
#![allow(
@@ -34,6 +34,8 @@ use std::os::fd::OwnedFd;
#[cfg(unix)]
use std::os::unix::fs::{PermissionsExt, symlink as symlink_dir, symlink as symlink_file};
#[cfg(unix)]
use std::os::unix::net::UnixListener;
#[cfg(unix)]
use std::os::unix::process::CommandExt;
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt;
@@ -1132,6 +1134,13 @@ impl AtPath {
}
}
#[cfg(unix)]
pub fn mksocket(&self, socket: &str) {
let full_path = self.plus_as_string(socket);
log_info("mksocket", &full_path);
UnixListener::bind(full_path).expect("Socket file creation failed.");
}
#[cfg(not(windows))]
pub fn is_fifo(&self, fifo: &str) -> bool {
unsafe {