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 +-
sftp.c | 4 ++--
3 files changed, 6 insertions(+), 6 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 f1aed8949669..859e93f31111 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1892,7 +1892,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':
diff --git a/sftp.c b/sftp.c
index 725ce2872b4a..db5482f7eff8 100644
--- a/sftp.c
+++ b/sftp.c
@@ -344,10 +344,10 @@ local_do_shell(const char *args)
/* XXX: child has pipe fds to ssh subproc open - issue? */
if (args) {
debug3("Executing %s -c \"%s\"", shell, args);
- execl(shell, shell, "-c", args, (char *)NULL);
+ execl(shell, shell, "-c", args, NULL);
} else {
debug3("Executing %s", shell);
- execl(shell, shell, (char *)NULL);
+ execl(shell, shell, NULL);
}
fprintf(stderr, "Couldn't execute \"%s\": %s\n",
shell,
strerror(errno));
--
2.33.0
On Thu, 30 Sep 2021, Mike Frysinger wrote:> - execl(shell, shell, "-c", args, (char *)NULL); > + execl(shell, shell, "-c", args, NULL);This just introduced a bug on LP64 platforms on some OSes ;-) tl;dr: there are OSes that #define NULL 0 (and dalias even defends doing so), and this is all the standards guarantee as well, so use of a nil pointer constant as sentinel must be explicitly cast, otherwise it?s just an int. The style(9) manpage of various BSDs has a paragraph on that (regarding variadic functions). bye, //mirabilos -- 15:41?<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
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
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 +++---
1 file changed, 3 insertions(+), 3 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);
--
2.33.0