~kota/pcf

c6c556eba88986632f3dabddb3b6d0989bf95050 — Dakota Walsh 1 year, 30 days ago 583c6fd
exit on error when failing to read file

This patch makes pcf exit with a 1 if it fails to read any input. It was
already printing an error message so this makes sense.
1 files changed, 2 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +2 -0
@@ 53,6 53,7 @@ func exit(c *ftp.ServerConn) {
func put(f *os.File, n string, u *url.URL) {
	if _, err := f.Seek(0, 0); err != nil {
		fmt.Fprintf(os.Stderr, "pcf: failed to read: %v\n", err)
		os.Exit(1)
	}
	c := login(u)
	store(f, c, n)


@@ 63,6 64,7 @@ func put(f *os.File, n string, u *url.URL) {
func hash(f *os.File) string {
	if _, err := f.Seek(0, 0); err != nil {
		fmt.Fprintf(os.Stderr, "pcf: failed to read: %v\n", err)
		os.Exit(1)
	}
	h := sha1.New()
	if _, err := io.Copy(h, f); err != nil {