]> andersk Git - moira.git/commitdiff
use read(), not streams to read motd file
authormar <mar>
Wed, 28 Jun 1989 14:02:18 +0000 (14:02 +0000)
committermar <mar>
Wed, 28 Jun 1989 14:02:18 +0000 (14:02 +0000)
server/mr_scall.c

index ed005d150c767eceb86446e5c93936f468114207..574ced8ec272526b9ba72103f1bd9b711dd7d23b 100644 (file)
@@ -16,6 +16,7 @@ static char *rcsid_sms_scall_c = "$Header$";
 #include <mit-copyright.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/file.h>
 #include <krb.h>
 #include <errno.h>
 #include "query.h"
@@ -336,16 +337,17 @@ trigger_dcm(dummy0, dummy1, cl)
 get_motd(cl)
 client *cl;
 {
-    FILE *motd;
+    int motd, len;
     char buffer[1024];
     char *arg[1];
 
     arg[0] = buffer;
     cl->reply.sms_status = 0;
-    motd = fopen(SMS_MOTD_FILE, "r");
-    if (motd == NULL) return;
-    fgets(buffer, sizeof(buffer), motd);
-    fclose(motd);
+    motd = open(SMS_MOTD_FILE, 0, O_RDONLY);
+    if (motd < 0) return;
+    len = read(motd, buffer, sizeof(buffer) - 1);
+    close(motd);
+    buffer[len] = 0;
     retr_callback(1, arg, cl);
     cl->reply.sms_status = 0;
 }
This page took 0.102786 seconds and 5 git commands to generate.