1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

Ports: Remove obsolete patches for <limits.h>

This commit is contained in:
Gunnar Beutner 2021-04-12 13:35:46 +02:00 committed by Andreas Kling
parent e95cb252be
commit 0f98569617
6 changed files with 0 additions and 452 deletions

View file

@ -1,17 +0,0 @@
--- dash-0.5.10.2/src/shell.h.orig Sun Sep 28 04:19:32 2014
+++ dash-0.5.10.2/src/shell.h Fri Apr 24 18:25:38 2020
@@ -51,6 +51,14 @@
#include <sys/param.h>
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+#ifndef NAME_MAX
+#define NAME_MAX 1024
+#endif
+
#ifndef JOBS
#define JOBS 1
#endif

View file

@ -88,16 +88,3 @@ index fd7b257..9f5ced8 100644
free(p);
}
diff --git a/src/util.c b/src/util.c
index df83952..58c95c8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -136,7 +136,7 @@ jv jq_realpath(jv path) {
#ifdef _PC_PATH_MAX
path_max = pathconf(jv_string_value(path),_PC_PATH_MAX);
#else
- path_max = PATH_MAX;
+ path_max = 4096;
#endif
if (path_max > 0) {
buf = jv_mem_alloc(path_max);

View file

@ -1,11 +0,0 @@
--- libarchive-3.4.0/libarchive/archive_read_disk_posix.c 2019-06-12 18:05:16.000000000 -0300
+++ libarchive-3.4.0-new/libarchive/archive_read_disk_posix.c 2019-10-12 22:30:12.774683968 -0300
@@ -1984,7 +1984,7 @@
# else
/* No way to get a trusted value of maximum filename
* length. */
- t->current_filesystem->name_max = PATH_MAX;
+ t->current_filesystem->name_max = 4096; /* Toolchain workaround */
# endif /* NAME_MAX */
# if defined(_PC_NAME_MAX)
else

View file

@ -1,33 +0,0 @@
--- a/builtin/cd.c 2020-02-03 17:38:39.619544218 +0300
+++ b/builtin/cd.c 2020-02-03 17:39:18.387886672 +0300
@@ -10,6 +10,8 @@
#include <unistd.h>
#include "builtin.h"
+#define PATH_MAX 4096
+
static const char cd_usage[] = "usage: cd [-L|-P] [-|directory]\n";
static int cd(struct mrsh_state *state, const char *path) {
--- a/shell/entry.c 2020-02-03 18:02:41.502709181 +0300
+++ b/shell/entry.c 2020-02-03 18:03:02.254888038 +0300
@@ -12,6 +12,8 @@
#include "parser.h"
#include "shell/trap.h"
+#define PATH_MAX 4096
+
static char *expand_str(struct mrsh_state *state, const char *src) {
struct mrsh_parser *parser = mrsh_parser_with_data(src, strlen(src));
if (parser == NULL) {
--- a/shell/path.c 2020-02-03 18:03:55.014342748 +0300
+++ b/shell/path.c 2020-02-03 18:04:08.167456108 +0300
@@ -8,6 +8,8 @@
#include <unistd.h>
#include "shell/path.h"
+#define PATH_MAX 4096
+
const char *expand_path(struct mrsh_state *state, const char *file, bool exec,
bool default_path) {
if (strchr(file, '/')) {

View file

@ -1,300 +0,0 @@
90d6ca5fd87f81c62f3cdde73d4366cfccbab846 Add serenity_limits.h as a slight replacement of limits.h
diff --git a/auth.c b/auth.c
index 086b8ebb..494bb824 100644
--- a/auth.c
+++ b/auth.c
@@ -77,6 +77,10 @@
#include "compat.h"
#include "channels.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* import */
extern ServerOptions options;
extern struct include_list includes;
diff --git a/clientloop.c b/clientloop.c
index 3ff4ea89..80fd49fa 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -112,6 +112,10 @@
#include "ssherr.h"
#include "hostfile.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* import options */
extern Options options;
diff --git a/misc.c b/misc.c
index 67464ef2..2442c744 100644
--- a/misc.c
+++ b/misc.c
@@ -77,6 +77,10 @@
#include "ssherr.h"
#include "platform.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* remove newline at end of string */
char *
chop(char *s)
diff --git a/moduli.c b/moduli.c
index 8dd36b1c..afee5a25 100644
--- a/moduli.c
+++ b/moduli.c
@@ -62,6 +62,10 @@
#include "openbsd-compat/openssl-compat.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/*
* File output defines
*/
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c
index 8fadca2d..d645c4c7 100644
--- a/openbsd-compat/bsd-closefrom.c
+++ b/openbsd-compat/bsd-closefrom.c
@@ -50,6 +50,10 @@
# include <libproc.h>
#endif
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#ifndef OPEN_MAX
# define OPEN_MAX 256
#endif
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c
index e8915178..0d3ee0b2 100644
--- a/openbsd-compat/glob.c
+++ b/openbsd-compat/glob.c
@@ -76,6 +76,10 @@
#include <string.h>
#include <unistd.h>
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#if !defined(HAVE_GLOB) || !defined(GLOB_HAS_ALTDIRFUNC) || \
!defined(GLOB_HAS_GL_MATCHC) || !defined(GLOB_HAS_GL_STATV) || \
!defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 || \
diff --git a/readconf.c b/readconf.c
index 034ad492..8ecaf697 100644
--- a/readconf.c
+++ b/readconf.c
@@ -70,6 +70,10 @@
#include "myproposal.h"
#include "digest.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* Format of the configuration file:
# Configuration data is parsed as follows:
diff --git a/scp.c b/scp.c
index b4492a06..155029aa 100644
--- a/scp.c
+++ b/scp.c
@@ -123,6 +123,10 @@
#include "progressmeter.h"
#include "utf8.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
extern char *__progname;
#define COPY_BUFLEN 16384
diff --git a/serenity_limits.h b/serenity_limits.h
new file mode 100644
index 00000000..8ee56cc2
--- /dev/null
+++ b/serenity_limits.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This header exists because limits.h just straight up does not work.
+ * OpenSSH requires PATH_MAX and SSIZE_MAX and while all the files that require it do include limits.h, it just does not work.
+ * For example:
+ * auth.c:430:30: error: 'PATH_MAX' undeclared (first use in this function)
+ * 430 | char *file, uidstr[32], ret[PATH_MAX];
+ * |
+ * But, defining them here does work? No idea why any of this happens.
+ */
+
+#define PATH_MAX 4096
+#define SSIZE_MAX 2147483647
diff --git a/servconf.c b/servconf.c
index 02b68a9a..dddf1b3c 100644
--- a/servconf.c
+++ b/servconf.c
@@ -72,6 +72,10 @@
#include "myproposal.h"
#include "digest.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
static void add_listen_addr(ServerOptions *, const char *,
const char *, int);
static void add_one_listen_addr(ServerOptions *, const char *,
diff --git a/session.c b/session.c
index 18cdfa8c..ca1f0c8b 100644
--- a/session.c
+++ b/session.c
@@ -105,6 +105,10 @@
#include <selinux/selinux.h>
#endif
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#define IS_INTERNAL_SFTP(c) \
(!strncmp(c, INTERNAL_SFTP_NAME, sizeof(INTERNAL_SFTP_NAME) - 1) && \
(c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\0' || \
diff --git a/sftp-realpath.c b/sftp-realpath.c
index 9ac40181..d3c71ecd 100644
--- a/sftp-realpath.c
+++ b/sftp-realpath.c
@@ -44,6 +44,10 @@
# define SYMLOOP_MAX 32
#endif
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* XXX rewrite sftp-server to use POSIX realpath and remove this hack */
char *sftp_realpath(const char *path, char *resolved);
diff --git a/sftp-server.c b/sftp-server.c
index 359204fa..36c2f263 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -51,6 +51,10 @@
#include "sftp.h"
#include "sftp-common.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
char *sftp_realpath(const char *, char *); /* sftp-realpath.c */
/* Our verbosity */
diff --git a/sftp.c b/sftp.c
index 9ce7055a..a5cb9cee 100644
--- a/sftp.c
+++ b/sftp.c
@@ -70,6 +70,10 @@ typedef void EditLine;
#include "sftp-common.h"
#include "sftp-client.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#define DEFAULT_COPY_BUFLEN 32768 /* Size of buffer for up/download */
#define DEFAULT_NUM_REQUESTS 64 /* # concurrent outstanding requests */
diff --git a/ssh-add.c b/ssh-add.c
index e218270b..ad2fbf44 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -68,6 +68,10 @@
#include "digest.h"
#include "ssh-sk.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
/* argv0 */
extern char *__progname;
diff --git a/ssh-agent.c b/ssh-agent.c
index 811dc115..22d0fbe5 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -92,6 +92,10 @@
#include "ssh-pkcs11.h"
#include "sk-api.h"
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#ifndef DEFAULT_PROVIDER_WHITELIST
# define DEFAULT_PROVIDER_WHITELIST "/usr/lib*/*,/usr/local/lib*/*"
#endif
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 85e8a9e2..129d3276 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -66,6 +66,10 @@
#include "ssh-sk.h"
#include "sk-api.h" /* XXX for SSH_SK_USER_PRESENCE_REQD; remove */
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
#ifdef WITH_OPENSSL
# define DEFAULT_KEY_TYPE_NAME "rsa"
#else
diff --git a/ssh.c b/ssh.c
index 98b6ce78..5e559a5c 100644
--- a/ssh.c
+++ b/ssh.c
@@ -113,6 +113,10 @@
#include "ssh-pkcs11.h"
#endif
+#ifdef __serenity__
+#include "serenity_limits.h"
+#endif
+
extern char *__progname;
/* Saves a copy of argv for setproctitle emulation */

View file

@ -1,78 +0,0 @@
Common subdirectories: pt2-clone-1.28/src/gfx and pt2-clone-1.28d/src/gfx
diff -u pt2-clone-1.28/src/pt2_config.c pt2-clone-1.28d/src/pt2_config.c
--- pt2-clone-1.28/src/pt2_config.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_config.c 2021-01-22 13:34:22.058489000 +0100
@@ -21,6 +21,7 @@
#include "pt2_diskop.h"
#include "pt2_textout.h"
#include "pt2_sampler.h"
+#define PATH_MAX 4096
#ifndef _WIN32
static char oldCwd[PATH_MAX];
diff -u pt2-clone-1.28/src/pt2_diskop.c pt2-clone-1.28d/src/pt2_diskop.c
--- pt2-clone-1.28/src/pt2_diskop.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_diskop.c 2021-01-22 13:33:49.531212000 +0100
@@ -36,6 +36,7 @@
#include "pt2_visuals.h"
#include "pt2_sample_loader.h"
#include "pt2_bmp.h"
+#define PATH_MAX 4096
typedef struct fileEntry_t
{
diff -u pt2-clone-1.28/src/pt2_edit.c pt2-clone-1.28d/src/pt2_edit.c
--- pt2-clone-1.28/src/pt2_edit.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_edit.c 2021-01-22 13:33:14.987979000 +0100
@@ -29,6 +29,7 @@
#include "pt2_audio.h"
#include "pt2_sync.h"
#include "pt2_chordmaker.h"
+#define PATH_MAX 4096
const int8_t scancode2NoteLo[52] = // "USB usage page standard" order
{
diff -u pt2-clone-1.28/src/pt2_main.c pt2-clone-1.28d/src/pt2_main.c
--- pt2-clone-1.28/src/pt2_main.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_main.c 2021-01-22 13:33:34.867538000 +0100
@@ -36,6 +36,7 @@
#include "pt2_bmp.h"
#include "pt2_sync.h"
#include "pt2_sampling.h"
+#define PATH_MAX 4096
#define CRASH_TEXT "Oh no!\nThe ProTracker 2 clone has crashed...\n\nA backup .mod was hopefully " \
"saved to the current module directory.\n\nPlease report this bug if you can.\n" \
diff -u pt2-clone-1.28/src/pt2_module_loader.c pt2-clone-1.28d/src/pt2_module_loader.c
--- pt2-clone-1.28/src/pt2_module_loader.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_module_loader.c 2021-01-22 13:34:32.490256000 +0100
@@ -27,6 +27,7 @@
#include "pt2_sample_loader.h"
#include "pt2_config.h"
#include "pt2_sampling.h"
+#define PATH_MAX 4096
typedef struct mem_t
{
diff -u pt2-clone-1.28/src/pt2_mouse.c pt2-clone-1.28d/src/pt2_mouse.c
--- pt2-clone-1.28/src/pt2_mouse.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_mouse.c 2021-01-22 13:33:59.278995000 +0100
@@ -26,6 +26,7 @@
#include "pt2_bmp.h"
#include "pt2_sampling.h"
#include "pt2_chordmaker.h"
+#define PATH_MAX 4096
/* TODO: Move irrelevant routines outta here! Disgusting design!
** Keep in mind that this was programmed in my early programming days...
diff -u pt2-clone-1.28/src/pt2_sample_loader.c pt2-clone-1.28d/src/pt2_sample_loader.c
--- pt2-clone-1.28/src/pt2_sample_loader.c 2021-01-01 20:48:32.000000000 +0100
+++ pt2-clone-1.28d/src/pt2_sample_loader.c 2021-01-22 13:34:03.582900000 +0100
@@ -19,6 +19,7 @@
#include "pt2_config.h"
#include "pt2_sampling.h"
#include "pt2_downsamplers2x.h"
+#define PATH_MAX 4096
enum
{