From: mar Date: Wed, 28 Jun 1989 14:02:18 +0000 (+0000) Subject: use read(), not streams to read motd file X-Git-Tag: PATCH5~28 X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/9cad7c8fc2cb927d3a5b8eee101cb9f5ab457531 use read(), not streams to read motd file --- diff --git a/server/mr_scall.c b/server/mr_scall.c index ed005d15..574ced8e 100644 --- a/server/mr_scall.c +++ b/server/mr_scall.c @@ -16,6 +16,7 @@ static char *rcsid_sms_scall_c = "$Header$"; #include #include #include +#include #include #include #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; }