]> andersk Git - moira.git/blobdiff - update/get_file.c
added new proc type for MOTD
[moira.git] / update / get_file.c
index 8495caa922367422e417b3dd8d87098f6c92e379..f0df2c086ebded1ea2b71de09be9c5ad7bea5b0a 100644 (file)
@@ -2,18 +2,22 @@
  *     $Source$
  *     $Header$
  */
+/*  (c) Copyright 1988 by the Massachusetts Institute of Technology. */
+/*  For copying and distribution information, please see the file */
+/*  <mit-copyright.h>. */
 
 #ifndef lint
 static char *rcsid_get_file_c = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include <stdio.h>
-#include "gdb.h"
+#include <gdb.h>
 #include <ctype.h>
 #include <sys/param.h>
 #include <sys/file.h>
+#include <sms.h>
 #include "update.h"
-#include "smsu_int.h"
 #include "kludge.h"
 
 extern CONNECTION conn;
@@ -67,7 +71,7 @@ get_file(pathname, file_size, checksum)
     int found_checksum;
     
     if (!have_authorization) {
-       reject_call(SMSU_NO_AUTH);
+       reject_call(SMS_PERM);
        return(1);
     }
     if (done)                  /* re-initialize data */
@@ -129,21 +133,14 @@ get_file(pathname, file_size, checksum)
     fsync(fd);
     close(fd);
     /* validate checksum */
-    fd = open(pathname, O_RDONLY, 0);
-    if (fd == -1) {
-       code = errno;
-       report_error("re-opening file for checksum verification");
-       return(1);
-    }
-    found_checksum = checksum_fd(fd);
+    found_checksum = checksum_file(pathname);
     if (checksum != found_checksum) {
-       code = SMSU_CHECKSUM;
+       code = SMS_MISSINGFILE;
        com_err(whoami, code, ": expected = %d, found = %d",
                checksum, found_checksum);
        report_error("checksum error");
        return(1);
     }
-    close(fd);
     /* send ack or nack */
     have_file = 1;
     if (send_ok()) {
This page took 0.152108 seconds and 4 git commands to generate.