]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: replace remaining cases where we manually included __func__
authordjm@openbsd.org <djm@openbsd.org>
Tue, 2 Sep 2025 09:26:21 +0000 (09:26 +0000)
committerDamien Miller <djm@mindrot.org>
Tue, 2 Sep 2025 09:27:03 +0000 (19:27 +1000)
in a debug or error log with the respective *_f log variant

OpenBSD-Commit-ID: 46a280d78bcc0bc98f28e65a30b613366600328f

sftp-client.c
sftp-server.c
srclimit.c

index 9f8ab4afa3e944049bc22e0bf7e732b04efffbc8..3d8bb34961c9c572d2754a67ef1392dd65b8906e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.177 2025/03/11 07:48:51 dtucker Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.178 2025/09/02 09:26:21 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -1138,7 +1138,7 @@ sftp_copy(struct sftp_conn *conn, const char *oldpath, const char *newpath)
        attr.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
 
        if ((msg = sshbuf_new()) == NULL)
-               fatal("%s: sshbuf_new failed", __func__);
+               fatal_f("sshbuf_new failed");
 
        attrib_clear(&junk); /* Send empty attributes */
 
@@ -1149,7 +1149,7 @@ sftp_copy(struct sftp_conn *conn, const char *oldpath, const char *newpath)
            (r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
            (r = sshbuf_put_u32(msg, SSH2_FXF_READ)) != 0 ||
            (r = encode_attrib(msg, &junk)) != 0)
-               fatal("%s: buffer error: %s", __func__, ssh_err(r));
+               fatal_fr(r, "buffer error");
        send_msg(conn, msg);
        debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, oldpath);
 
@@ -1170,7 +1170,7 @@ sftp_copy(struct sftp_conn *conn, const char *oldpath, const char *newpath)
            (r = sshbuf_put_u32(msg, SSH2_FXF_WRITE|SSH2_FXF_CREAT|
            SSH2_FXF_TRUNC)) != 0 ||
            (r = encode_attrib(msg, &attr)) != 0)
-               fatal("%s: buffer error: %s", __func__, ssh_err(r));
+               fatal_fr(r, "buffer error");
        send_msg(conn, msg);
        debug3("Sent message SSH2_FXP_OPEN I:%u P:%s", id, newpath);
 
@@ -1194,7 +1194,7 @@ sftp_copy(struct sftp_conn *conn, const char *oldpath, const char *newpath)
            (r = sshbuf_put_u64(msg, 0)) != 0 ||
            (r = sshbuf_put_string(msg, new_handle, new_handle_len)) != 0 ||
            (r = sshbuf_put_u64(msg, 0)) != 0)
-               fatal("%s: buffer error: %s", __func__, ssh_err(r));
+               fatal_fr(r, "buffer error");
        send_msg(conn, msg);
        debug3("Sent message copy-data \"%s\" 0 0 -> \"%s\" 0",
               oldpath, newpath);
index a4abb9f7cfeec42f76b504602b89dbf870e46150..c3baebd86410126425f400f8784d76462b87cd06 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.148 2024/04/30 06:23:51 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.149 2025/09/02 09:26:21 djm Exp $ */
 /*
  * Copyright (c) 2000-2004 Markus Friedl.  All rights reserved.
  *
@@ -1620,7 +1620,7 @@ process_extended_copy_data(u_int32_t id)
            (r = sshbuf_get_u64(iqueue, &read_len)) != 0 ||
            (r = get_handle(iqueue, &write_handle)) != 0 ||
            (r = sshbuf_get_u64(iqueue, &write_off)) != 0)
-               fatal("%s: buffer error: %s", __func__, ssh_err(r));
+               fatal_fr(r, "buffer error");
 
        debug("request %u: copy-data from \"%s\" (handle %d) off %llu len %llu "
            "to \"%s\" (handle %d) off %llu",
@@ -1648,14 +1648,14 @@ process_extended_copy_data(u_int32_t id)
 
        if (lseek(read_fd, read_off, SEEK_SET) < 0) {
                status = errno_to_portable(errno);
-               error("%s: read_seek failed", __func__);
+               error_f("read_seek failed");
                goto out;
        }
 
        if ((handle_to_flags(write_handle) & O_APPEND) == 0 &&
            lseek(write_fd, write_off, SEEK_SET) < 0) {
                status = errno_to_portable(errno);
-               error("%s: write_seek failed", __func__);
+               error_f("write_seek failed");
                goto out;
        }
 
@@ -1670,7 +1670,7 @@ process_extended_copy_data(u_int32_t id)
                        break;
                } else if (ret == 0) {
                        status = errno_to_portable(errno);
-                       error("%s: read failed: %s", __func__, strerror(errno));
+                       error_f("read failed: %s", strerror(errno));
                        break;
                }
                len = ret;
index c63a462e27836ffb36ceefb7cff0467c43694835..8a47588e4f5b32fa4e5b2db636c7c8b93b7d3313 100644 (file)
@@ -119,7 +119,7 @@ srclimit_init(int max, int persource, int ipv4len, int ipv6len,
        debug("%s: max connections %d, per source %d, masks %d,%d", __func__,
            max, persource, ipv4len, ipv6len);
        if (max <= 0)
-               fatal("%s: invalid number of sockets: %d", __func__, max);
+               fatal_f("invalid number of sockets: %d", max);
        children = xcalloc(max_children, sizeof(*children));
        for (i = 0; i < max_children; i++)
                children[i].id = -1;
@@ -136,7 +136,7 @@ srclimit_check_allow(int sock, int id)
        if (max_persource == INT_MAX)   /* no limit */
                return 1;
 
-       debug("%s: sock %d id %d limit %d", __func__, sock, id, max_persource);
+       debug_f("sock %d id %d limit %d", sock, id, max_persource);
        if (srclimit_peer_addr(sock, &xa) != 0)
                return 1;
        bits = xa.af == AF_INET ? ipv4_masklen : ipv6_masklen;
@@ -154,14 +154,14 @@ srclimit_check_allow(int sock, int id)
                }
        }
        if (addr_ntop(&xa, xas, sizeof(xas)) != 0) {
-               debug3("%s: addr ntop failed", __func__);
+               debug3_f("addr ntop failed");
                return 1;
        }
        debug3("%s: new unauthenticated connection from %s/%d, at %d of %d",
            __func__, xas, bits, count, max_persource);
 
        if (first_unused == max_children) { /* no free slot found */
-               debug3("%s: no free slot", __func__);
+               debug3_f("no free slot");
                return 0;
        }
        if (first_unused < 0 || first_unused >= max_children)
@@ -185,7 +185,7 @@ srclimit_done(int id)
        if (max_persource == INT_MAX)   /* no limit */
                return;
 
-       debug("%s: id %d", __func__, id);
+       debug_f("id %d", id);
        /* Clear corresponding state entry. */
        for (i = 0; i < max_children; i++) {
                if (children[i].id == id) {