X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=blobdiff_plain;f=src%2Fcmd%2Fnncp-xfer%2Fmain.go;h=8685b1c1c5324633c292e2cbe53b08d21e52f03b;hp=bb74f45cd4482b9f7bb97a0ec8e0cd29a1b79149;hb=72f42f8288689ae89e021ba33ebca8d551a784d7;hpb=beefc4fd7137435caf9c653633ab938947df07f8 diff --git a/src/cmd/nncp-xfer/main.go b/src/cmd/nncp-xfer/main.go index bb74f45..8685b1c 100644 --- a/src/cmd/nncp-xfer/main.go +++ b/src/cmd/nncp-xfer/main.go @@ -24,6 +24,7 @@ import ( "flag" "fmt" "io" + "io/fs" "log" "os" "path/filepath" @@ -120,7 +121,7 @@ func main() { } ctx.LogD("xfer-self", les, logMsg) if _, err = os.Stat(selfPath); err != nil { - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { ctx.LogD("xfer-self-no-dir", les, func(les nncp.LEs) string { return logMsg(les) + ": no directory" }) @@ -215,7 +216,7 @@ func main() { string(nncp.TRx), nncp.SeenDir, fiInt.Name(), - )); err == nil || !os.IsNotExist(err) { + )); err == nil || !errors.Is(err, fs.ErrNotExist) { ctx.LogI("xfer-rx-seen", les, func(les nncp.LEs) string { return logMsg(les) + ": packet already seen" }) @@ -389,7 +390,7 @@ Tx: } _, err = os.Stat(nodePath) if err != nil { - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { ctx.LogD("xfer-tx-not-exist", les, func(les nncp.LEs) string { return logMsg(les) + ": does not exist" }) @@ -420,7 +421,7 @@ Tx: } _, err = os.Stat(dstPath) if err != nil { - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { if err = os.Mkdir(dstPath, os.FileMode(0777)); err != nil { ctx.UnlockDir(dirLock) ctx.LogE("xfer-tx-mkdir", les, err, logMsg) @@ -450,7 +451,7 @@ Tx: }) continue } - if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !os.IsNotExist(err) { + if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !errors.Is(err, fs.ErrNotExist) { ctx.LogD("xfer-tx-exists", les, func(les nncp.LEs) string { return logMsg(les) + ": already exists" })