]> andersk Git - moira.git/commitdiff
Handle fencepost of empty file correctly
authormar <mar>
Tue, 23 Aug 1988 11:47:36 +0000 (11:47 +0000)
committermar <mar>
Tue, 23 Aug 1988 11:47:36 +0000 (11:47 +0000)
update/send_file.c

index da007b602b5c0e39f007745c736c651a3ff6b160..ec3c9f5361b484d0d1ea5ae8d0c2f6dcb0ac1a2e 100644 (file)
@@ -94,6 +94,7 @@ char *target_path;
        close(fd);
        return(n);
     }
+
     while (n_to_send > 0) {
 #ifdef DEBUG
        printf("n_to_send = %d\n", n_to_send);
@@ -128,6 +129,22 @@ char *target_path;
            return(n);
        }
     }
+    if (statb.st_size == 0) {
+       code = receive_object(conn, (char *)&n, INTEGER_T);
+       if (code) {
+           com_err(whoami, connection_errno(conn),
+                   " awaiting ACK remote server after transmission of %s",
+                   pathname);
+           close(fd);
+           return(code);
+       }
+       if (n) {
+           com_err(whoami, n, " from remote server after transmission of %s",
+                   pathname);
+           close(fd);
+           return(n);
+       }
+    }
     close(fd);
     return(SMS_SUCCESS);
 }
This page took 2.032317 seconds and 5 git commands to generate.