From d26fe7a6f0103e3e0181630042c8f681d16eac6c Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 22 Jul 2016 03:47:36 +0000 Subject: [PATCH] constify a few functions' arguments; patch from Jakub Jelen bz#2581 --- usr.bin/ssh/sftp.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index daeb6784d10..938e4eba9bb 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.174 2016/05/25 23:48:45 schwarze Exp $ */ +/* $OpenBSD: sftp.c,v 1.175 2016/07/22 03:47:36 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -315,7 +315,7 @@ local_do_ls(const char *args) /* Strip one path (usually the pwd) from the start of another */ static char * -path_strip(char *path, char *strip) +path_strip(const char *path, const char *strip) { size_t len; @@ -333,7 +333,7 @@ path_strip(char *path, char *strip) } static char * -make_absolute(char *p, char *pwd) +make_absolute(char *p, const char *pwd) { char *abs_str; @@ -531,7 +531,7 @@ parse_no_flags(const char *cmd, char **argv, int argc) } static int -is_dir(char *path) +is_dir(const char *path) { struct stat sb; @@ -543,7 +543,7 @@ is_dir(char *path) } static int -remote_is_dir(struct sftp_conn *conn, char *path) +remote_is_dir(struct sftp_conn *conn, const char *path) { Attrib *a; @@ -557,7 +557,7 @@ remote_is_dir(struct sftp_conn *conn, char *path) /* Check whether path returned from glob(..., GLOB_MARK, ...) is a directory */ static int -pathname_is_dir(char *pathname) +pathname_is_dir(const char *pathname) { size_t l = strlen(pathname); @@ -565,8 +565,8 @@ pathname_is_dir(char *pathname) } static int -process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, - int pflag, int rflag, int resume, int fflag) +process_get(struct sftp_conn *conn, const char *src, const char *dst, + const char *pwd, int pflag, int rflag, int resume, int fflag) { char *abs_src = NULL; char *abs_dst = NULL; @@ -651,8 +651,8 @@ out: } static int -process_put(struct sftp_conn *conn, char *src, char *dst, char *pwd, - int pflag, int rflag, int resume, int fflag) +process_put(struct sftp_conn *conn, const char *src, const char *dst, + const char *pwd, int pflag, int rflag, int resume, int fflag) { char *tmp_dst = NULL; char *abs_dst = NULL; @@ -762,7 +762,8 @@ sdirent_comp(const void *aa, const void *bb) /* sftp ls.1 replacement for directories */ static int -do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) +do_ls_dir(struct sftp_conn *conn, const char *path, + const char *strip_path, int lflag) { int n; u_int c = 1, colspace = 0, columns = 1; @@ -847,8 +848,8 @@ do_ls_dir(struct sftp_conn *conn, char *path, char *strip_path, int lflag) /* sftp ls.1 replacement which handles path globs */ static int -do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path, - int lflag) +do_globbed_ls(struct sftp_conn *conn, const char *path, + const char *strip_path, int lflag) { char *fname, *lname; glob_t g; @@ -932,7 +933,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path, } static int -do_df(struct sftp_conn *conn, char *path, int hflag, int iflag) +do_df(struct sftp_conn *conn, const char *path, int hflag, int iflag) { struct sftp_statvfs st; char s_used[FMT_SCALED_STRSIZE]; -- 2.20.1