From 4c5f1ccc3f27ce8ea51e9e0a0387a82e131a78ba Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 26 Dec 1999 22:53:25 +0000 Subject: Minor optimizations from Federico. svn path=/trunk/; revision=2689 --- fetchmail.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'fetchmail.c') diff --git a/fetchmail.c b/fetchmail.c index fc8490fb..6015411d 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -34,6 +34,7 @@ #ifdef HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ +#include #ifdef HAVE_GETHOSTBYNAME #include @@ -183,7 +184,7 @@ int main(int argc, char **argv) #endif #define IDFILE_NAME ".fetchids" - run.idfile = (char *) xmalloc(strlen(home)+strlen(IDFILE_NAME)+2); + run.idfile = (char *) xmalloc(strlen(home)+sizeof(IDFILE_NAME)+1); strcpy(run.idfile, home); strcat(run.idfile, "/"); strcat(run.idfile, IDFILE_NAME); @@ -267,10 +268,10 @@ int main(int argc, char **argv) #define FETCHMAIL_PIDFILE "fetchmail.pid" if (!getuid()) { xalloca(tmpbuf, char *, - strlen(PID_DIR) + strlen(FETCHMAIL_PIDFILE) + 2); + sizeof(PID_DIR) + sizeof(FETCHMAIL_PIDFILE)); sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE); } else { - xalloca(tmpbuf, char *, strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3); + xalloca(tmpbuf, char *, strlen(home) + sizeof(FETCHMAIL_PIDFILE) + 2); strcpy(tmpbuf, home); strcat(tmpbuf, "/."); strcat(tmpbuf, FETCHMAIL_PIDFILE); @@ -294,7 +295,7 @@ int main(int argc, char **argv) #define NETRC_FILE ".netrc" /* parse the ~/.netrc file (if present) for future password lookups. */ - xalloca(netrc_file, char *, strlen (home) + strlen(NETRC_FILE) + 2); + xalloca(netrc_file, char *, strlen (home) + sizeof(NETRC_FILE) + 1); strcpy (netrc_file, home); strcat (netrc_file, "/"); strcat (netrc_file, NETRC_FILE); -- cgit v1.2.3