summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheimpostor <sahirhoda@gmail.com>2023-08-07 08:22:04 -0500
committertheimpostor <sahirhoda@gmail.com>2023-08-07 08:22:04 -0500
commitba4b74f3a1d6cfd9548051033ac5b542d2c0d481 (patch)
tree1285feb84768b10a02b8844309ee319eb83ecb9a
parent3647790710b86437eccf5867c9d2d4eb860eb1e4 (diff)
check files readable for copy
-rw-r--r--main.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.go b/main.go
index 9cd7fa2..25d2e75 100644
--- a/main.go
+++ b/main.go
@@ -106,6 +106,14 @@ func copy(fnames []string) error {
// copy
if len(fnames) == 0 {
fnames = []string{"-"}
+ } else {
+ for _, fname := range fnames {
+ if f, err := os.Open(fname); err != nil {
+ return err
+ } else {
+ f.Close()
+ }
+ }
}
slog.Debug("Beginning osc52 copy operation")