Fixed upper bound check for data shard cli argument in example encoders and file permission issue. (#98)

master
Lennart Oldenburg 2019-04-07 17:36:31 +02:00 committed by Klaus Post
parent a9588190c0
commit a373324398
2 changed files with 5 additions and 5 deletions

View File

@ -67,8 +67,8 @@ func main() {
flag.Usage()
os.Exit(1)
}
if *dataShards > 257 {
fmt.Fprintf(os.Stderr, "Error: Too many data shards\n")
if (*dataShards + *parShards) > 256 {
fmt.Fprintf(os.Stderr, "Error: sum of data and parity shards cannot exceed 256\n")
os.Exit(1)
}
fname := args[0]
@ -99,7 +99,7 @@ func main() {
outfn := fmt.Sprintf("%s.%d", file, i)
fmt.Println("Writing to", outfn)
err = ioutil.WriteFile(filepath.Join(dir, outfn), shard, os.ModePerm)
err = ioutil.WriteFile(filepath.Join(dir, outfn), shard, 0644)
checkErr(err)
}
}

View File

@ -68,8 +68,8 @@ func main() {
flag.Usage()
os.Exit(1)
}
if *dataShards > 257 {
fmt.Fprintf(os.Stderr, "Error: Too many data shards\n")
if (*dataShards + *parShards) > 256 {
fmt.Fprintf(os.Stderr, "Error: sum of data and parity shards cannot exceed 256\n")
os.Exit(1)
}
fname := args[0]