From: jan Date: Sun, 23 May 2021 17:01:21 +0000 (+0000) Subject: Constify function parameters. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0c50dd5d4782658def1b8b6a1b67fdff43a80a10;p=openbsd Constify function parameters. OK martijn@ --- diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 0acafe955b8..28e28eb972c 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.22 2021/05/20 15:21:03 jan Exp $ */ +/* $OpenBSD: extern.h,v 1.23 2021/05/23 17:01:21 jan Exp $ */ /* $NetBSD: extern.h,v 1.2 1995/04/11 02:44:49 cgd Exp $ */ /* @@ -64,38 +64,38 @@ void blkfree(char **); char **copyblk(char **); void cwd(char *); -void delete(char *); +void delete(const char *); void dologout(int); -void fatal(char *); +void fatal(const char *); int ftpd_pclose(FILE *, pid_t); FILE *ftpd_ls(const char *, pid_t *); int get_line(char *, int); -void ftpdlogwtmp(char *, char *, char *); +void ftpdlogwtmp(const char *, const char *, const char *); void lreply(int, const char *, ...); -void makedir(char *); -void nack(char *); +void makedir(const char *); +void nack(const char *); enum auth_ret pass(char *); void passive(void); int epsvproto2af(int); int af2epsvproto(int); -void long_passive(char *, int); +void long_passive(const char *, int); int extended_port(const char *); void epsv_protounsupp(const char *); -void perror_reply(int, char *); +void perror_reply(int, const char *); void pwd(void); -void removedir(char *); -void renamecmd(char *, char *); +void removedir(const char *); +void renamecmd(const char *, const char *); char *renamefrom(char *); void reply(int, const char *, ...); void reply_r(int, const char *, ...); enum ret_cmd { RET_FILE, RET_LIST }; -void retrieve(enum ret_cmd, char *); +void retrieve(enum ret_cmd, const char *); void send_file_list(char *); void setproctitle(const char *, ...); void statcmd(void); -void statfilecmd(char *); -void store(char *, char *, int); +void statfilecmd(const char *); +void store(const char *, const char *, int); void upper(char *); void user(char *); void yyerror(char *); diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 96266b5ff1d..463513cb488 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpcmd.y,v 1.71 2021/05/22 14:25:30 jan Exp $ */ +/* $OpenBSD: ftpcmd.y,v 1.72 2021/05/23 17:01:21 jan Exp $ */ /* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */ /* @@ -1065,8 +1065,8 @@ struct tab sitetab[] = { static void help(struct tab *, char *); static struct tab * - lookup(struct tab *, char *); -static void sizecmd(char *); + lookup(struct tab *, const char *); +static void sizecmd(const char *); static int yylex(void); extern int epsvall; @@ -1074,7 +1074,7 @@ extern int epsvall; static struct tab * lookup(p, cmd) struct tab *p; - char *cmd; + const char *cmd; { for (; p->name != NULL; p++) @@ -1505,7 +1505,7 @@ help(ctab, s) static void sizecmd(filename) - char *filename; + const char *filename; { switch (type) { case TYPE_L: diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 88b9ef5db59..6232c6ab700 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.231 2021/05/22 14:30:46 jan Exp $ */ +/* $OpenBSD: ftpd.c,v 1.232 2021/05/23 17:01:21 jan Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -191,28 +191,28 @@ char proctitle[BUFSIZ]; /* initial part of title */ (long long)(cnt)); \ } -static void ack(char *); +static void ack(const char *); static void sigurg(int); static void myoob(void); -static int checkuser(char *, char *); -static FILE *dataconn(char *, off_t, char *); +static int checkuser(char *, const char *); +static FILE *dataconn(const char *, off_t, char *); static void dolog(struct sockaddr *); static char *copy_dir(char *, struct passwd *); static char *curdir(void); static void end_login(void); static FILE *getdatasock(char *); -static int guniquefd(char *, char **); +static int guniquefd(const char *, char **); static void lostconn(int); static void sigquit(int); static int receive_data(FILE *, FILE *); static void replydirname(const char *, const char *); static int send_data(FILE *, FILE *, off_t, off_t, int); static struct passwd * - sgetpwnam(char *, struct passwd *); + sgetpwnam(const char *, struct passwd *); static void reapchild(int); static void usage(void); -void logxfer(char *, off_t, time_t); +void logxfer(const char *, off_t, time_t); void set_slave_signals(void); static char * @@ -636,7 +636,7 @@ sigquit(int signo) * (e.g., globbing). */ static struct passwd * -sgetpwnam(char *name, struct passwd *pw) +sgetpwnam(const char *name, struct passwd *pw) { static struct passwd *save; struct passwd *old; @@ -817,7 +817,7 @@ user(char *name) * Check if a user is in the file "fname" */ static int -checkuser(char *fname, char *name) +checkuser(char *fname, const char *name) { FILE *fp; int found = 0; @@ -1110,7 +1110,7 @@ bad: } void -retrieve(enum ret_cmd cmd, char *name) +retrieve(enum ret_cmd cmd, const char *name) { FILE *fin, *dout; struct stat st; @@ -1186,7 +1186,7 @@ done: } void -store(char *name, char *mode, int unique) +store(const char *name, const char *mode, int unique) { FILE *fout, *din; int (*closefunc)(FILE *); @@ -1332,7 +1332,7 @@ bad: } static FILE * -dataconn(char *name, off_t size, char *mode) +dataconn(const char *name, off_t size, char *mode) { char sizebuf[32]; FILE *file = NULL; @@ -1721,7 +1721,7 @@ got_oob: } void -statfilecmd(char *filename) +statfilecmd(const char *filename) { FILE *fin; int c; @@ -1882,7 +1882,7 @@ printaddr: } void -fatal(char *s) +fatal(const char *s) { reply(451, "Error in server: %s", s); @@ -1965,14 +1965,14 @@ lreply(int n, const char *fmt, ...) } static void -ack(char *s) +ack(const char *s) { reply(250, "%s command successful.", s); } void -nack(char *s) +nack(const char *s) { reply(502, "%s command not implemented.", s); @@ -1987,7 +1987,7 @@ yyerror(char *s) } void -delete(char *name) +delete(const char *name) { struct stat st; @@ -2057,7 +2057,7 @@ replydirname(const char *name, const char *message) } void -makedir(char *name) +makedir(const char *name) { LOGCMD("mkdir", name); @@ -2068,7 +2068,7 @@ makedir(char *name) } void -removedir(char *name) +removedir(const char *name) { LOGCMD("rmdir", name); @@ -2103,7 +2103,7 @@ renamefrom(char *name) } void -renamecmd(char *from, char *to) +renamecmd(const char *from, const char *to) { LOGCMD2("rename", from, to); @@ -2295,7 +2295,7 @@ af2epsvproto(int af) * 229 Entering Extended Passive Mode (|||port|) */ void -long_passive(char *cmd, int pf) +long_passive(const char *cmd, int pf) { socklen_t len; int on = 1; @@ -2530,7 +2530,7 @@ epsv_protounsupp(const char *message) * Generates failure reply on error. */ static int -guniquefd(char *local, char **nam) +guniquefd(const char *local, char **nam) { static char new[PATH_MAX]; struct stat st; @@ -2569,7 +2569,7 @@ guniquefd(char *local, char **nam) * Format and send reply containing system error number. */ void -perror_reply(int code, char *string) +perror_reply(int code, const char *string) { reply(code, "%s: %s.", string, strerror(errno)); @@ -2733,7 +2733,7 @@ reapchild(int signo) } void -logxfer(char *name, off_t size, time_t start) +logxfer(const char *name, off_t size, time_t start) { char buf[400 + (HOST_NAME_MAX+1)*4 + PATH_MAX*4]; char dir[PATH_MAX], path[PATH_MAX], rpath[PATH_MAX]; diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c index 708fb215c5f..76268f7cb98 100644 --- a/libexec/ftpd/logwtmp.c +++ b/libexec/ftpd/logwtmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logwtmp.c,v 1.12 2019/06/28 13:32:53 deraadt Exp $ */ +/* $OpenBSD: logwtmp.c,v 1.13 2021/05/23 17:01:21 jan Exp $ */ /* $NetBSD: logwtmp.c,v 1.4 1995/04/11 02:44:58 cgd Exp $ */ /* @@ -54,7 +54,7 @@ static int fd = -1; * after login, but before logout). */ void -ftpdlogwtmp(char *line, char *name, char *host) +ftpdlogwtmp(const char *line, const char *name, const char *host) { struct timeval tv; struct stat buf;