summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2008-11-24 23:55:26 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2008-11-24 23:55:26 +0000
commit0dd598771006b3756510c075f933d93f644adcbc (patch)
treec94ec6eb62c26502e84dcb4d95b8ca84d12954b0 /usr.sbin
parent9cb465a354841bfc7e46d5b60d81bc2be01d3ed8 (diff)
- when using fread/fwrite, do not swap the size and nmemb arguments. no
functionnal change here, just making use of fonctions the way C intended it ;-) From Jacek Masiulaniec <jacekm@dobremiasto.net>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/queue.c18
-rw-r--r--usr.sbin/smtpd/smtp_session.c6
2 files changed, 9 insertions, 15 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 7709a68c07b..bbff1a36d8c 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.14 2008/11/17 21:05:05 gilles Exp $ */
+/* $OpenBSD: queue.c,v 1.15 2008/11/24 23:55:25 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -658,8 +658,7 @@ queue_message_from_id(char *message_id, struct message *message)
goto bad;
}
- if (fread(message, 1, sizeof(struct message), fp) !=
- sizeof(struct message)) {
+ if (fread(message, sizeof(struct message), 1, fp) != 1) {
warnx("queue_load_submissions: fread: %s", message_id);
goto bad;
}
@@ -812,7 +811,6 @@ queue_record_submission(struct message *message)
int mode = O_CREAT|O_TRUNC|O_WRONLY|O_EXCL|O_SYNC;
int spret;
FILE *fp;
- int hm;
if (message->type & T_DAEMON_MESSAGE) {
spool = PATH_DAEMON;
@@ -872,8 +870,7 @@ queue_record_submission(struct message *message)
message->creation = time(NULL);
- if ((hm = fwrite(message, 1, sizeof(struct message), fp)) !=
- sizeof(struct message)) {
+ if (fwrite(message, sizeof(struct message), 1, fp) != 1) {
fclose(fp);
unlink(dbname);
return 0;
@@ -1145,8 +1142,7 @@ queue_update_database(struct message *message)
if (fp == NULL)
fatal("fdopen");
- if (fwrite(message, 1, sizeof(struct message), fp) !=
- sizeof(struct message))
+ if (fwrite(message, sizeof(struct message), 1, fp) != 1)
fatal("queue_update_database: cannot write database");
fflush(fp);
fsync(fd);
@@ -1232,8 +1228,7 @@ queue_init_submissions(void)
if (fp == NULL)
continue;
- if (fread(&message, 1, sizeof(struct message), fp) !=
- sizeof(struct message)) {
+ if (fread(&message, sizeof(struct message), 1, fp) != 1) {
fclose(fp);
continue;
}
@@ -1283,8 +1278,7 @@ queue_message_complete(struct message *messagep)
if (fp == NULL)
continue;
- if (fread(&message, 1, sizeof(struct message), fp) !=
- sizeof(struct message)) {
+ if (fread(&message, sizeof(struct message), 1, fp) != 1) {
fclose(fp);
continue;
}
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index cc99f33e9c6..6d1922ab602 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.9 2008/11/17 21:56:18 chl Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.10 2008/11/24 23:55:25 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -744,8 +744,8 @@ read:
size_t len;
len = strlen(line);
- fwrite(line, len, 1, s->s_msg.datafp);
- fwrite("\n", 1, 1, s->s_msg.datafp);
+ fwrite(line, 1, len, s->s_msg.datafp);
+ fwrite("\n", 1, 1, s->s_msg.datafp);
fflush(s->s_msg.datafp);
if (! (s->s_flags & F_8BITMIME)) {