Mailing List Archive

[PATCH v2] drop some obsolete (char*) casts
Some of these were in here to cast away const because underlying APIs
were missing const markings themselves, but those have been fixed now,
so clean these up.
---
sftp-glob.c | 6 +++---
sftp-server.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sftp-glob.c b/sftp-glob.c
index f573f98f01ec..a59de347b622 100644
--- a/sftp-glob.c
+++ b/sftp-glob.c
@@ -51,7 +51,7 @@ fudge_opendir(const char *path)

r = xcalloc(1, sizeof(*r));

- if (do_readdir(cur.conn, (char *)path, &r->dir)) {
+ if (do_readdir(cur.conn, path, &r->dir)) {
free(r);
return(NULL);
}
@@ -112,7 +112,7 @@ fudge_lstat(const char *path, struct stat *st)
{
Attrib *a;

- if (!(a = do_lstat(cur.conn, (char *)path, 1)))
+ if (!(a = do_lstat(cur.conn, path, 1)))
return(-1);

attrib_to_stat(a, st);
@@ -125,7 +125,7 @@ fudge_stat(const char *path, struct stat *st)
{
Attrib *a;

- if (!(a = do_stat(cur.conn, (char *)path, 1)))
+ if (!(a = do_stat(cur.conn, path, 1)))
return(-1);

attrib_to_stat(a, st);
diff --git a/sftp-server.c b/sftp-server.c
index efef57cadb0d..df186591e7fd 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1764,7 +1764,7 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw)
snprintf(uidstr, sizeof(uidstr), "%llu",
(unsigned long long)pw->pw_uid);
homedir = percent_expand(cp, "d", user_pw->pw_dir,
- "u", user_pw->pw_name, "U", uidstr, (char *)NULL);
+ "u", user_pw->pw_name, "U", uidstr, NULL);
free(cp);
break;
case 'p':
--
2.33.0

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH v2] drop some obsolete (char*) casts [ In reply to ]
On Thu, 30 Sep 2021, Mike Frysinger wrote:

> homedir = percent_expand(cp, "d", user_pw->pw_dir,
> - "u", user_pw->pw_name, "U", uidstr, (char *)NULL);
> + "u", user_pw->pw_name, "U", uidstr, NULL);

This also has the sentinel attribute and therefore requires the/a cast.

bye,
//mirabilos
--
15:41?<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH v2] drop some obsolete (char*) casts [ In reply to ]
On 01 Oct 2021 01:16, Thorsten Glaser wrote:
> On Thu, 30 Sep 2021, Mike Frysinger wrote:
>
> > homedir = percent_expand(cp, "d", user_pw->pw_dir,
> > - "u", user_pw->pw_name, "U", uidstr, (char *)NULL);
> > + "u", user_pw->pw_name, "U", uidstr, NULL);
>
> This also has the sentinel attribute and therefore requires the/a cast.

of course it is. the sftp.c file was the only one i was actually looking
at & testing, and the others i picked up with a grep. thanks.
-mike