]> Sergey Matveev's repositories - syncer.git/commitdiff
Preset destination value is dangerous
authorSergey Matveev <stargrave@stargrave.org>
Sun, 20 Sep 2015 18:59:39 +0000 (21:59 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 20 Sep 2015 18:59:39 +0000 (21:59 +0300)
syncer.go

index 3d96ccd8e543fcebd3db5c1059a0da302e2c5a71..3a9e68a23a3e1ca3233e4a604aed966fc8ad3ed6 100644 (file)
--- a/syncer.go
+++ b/syncer.go
@@ -35,7 +35,7 @@ import (
 var (
        blkSize   = flag.Int64("blk", 2*1<<10, "Block size (KiB)")
        statePath = flag.String("state", "state.bin", "Path to statefile")
-       dstPath   = flag.String("dst", "/dev/ada0", "Path to destination disk")
+       dstPath   = flag.String("dst", "", "Path to destination disk")
        srcPath   = flag.String("src", "/dev/da0", "Path to source disk")
 )
 
@@ -54,6 +54,10 @@ func main() {
        flag.Parse()
        bs := *blkSize * int64(1<<10)
 
+       if *dstPath == "" {
+               log.Fatalln("Not destination is specified")
+       }
+
        // Open source, calculate number of blocks
        var size int64
        src, err := os.Open(*srcPath)