]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
unbreak fuzzers for clang16
authorDamien Miller <djm@mindrot.org>
Mon, 8 Jan 2024 03:45:14 +0000 (14:45 +1100)
committerDamien Miller <djm@mindrot.org>
Mon, 8 Jan 2024 03:45:14 +0000 (14:45 +1100)
getopt() needs a throw() attribute to compile, so supply one when compiling
things with C++

openbsd-compat/getopt.h
openbsd-compat/openbsd-compat.h

index 65c8bc7fb60e853e8e2c17bcbe04f565d148699d..b050fa835f79bc0ac2759e7fa6e305eaef3720c9 100644 (file)
 #ifndef _GETOPT_H_
 #define _GETOPT_H_
 
+#ifndef __THROW
+# if defined __cplusplus
+#  define __THROW throw()
+# else
+#  define __THROW
+# endif
+#endif
+
 /*
  * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
  */
@@ -63,8 +71,8 @@ int    getopt_long_only(int, char * const *, const char *,
 
 #ifndef _GETOPT_DEFINED_
 #define _GETOPT_DEFINED_
-int     getopt(int, char * const *, const char *);
-int     getsubopt(char **, char * const *, char **);
+int     getopt(int, char * const *, const char *) __THROW;
+int     getsubopt(char **, char * const *, char **) __THROW;
 
 extern   char *optarg;                  /* getopt(3) external variables */
 extern   int opterr;
index 78faea9629bdc3533acbb87f8843f4b8bf339087..0823d6a8377fcaf01599d21e3ad27d7d821494b5 100644 (file)
 #include "blf.h"
 #include "fnmatch.h"
 
+#ifndef __THROW
+# if defined __cplusplus
+#  define __THROW throw()
+# else
+#  define __THROW
+# endif
+#endif
+
 #if defined(HAVE_LOGIN_CAP) && !defined(HAVE_LOGIN_GETPWCLASS)
 # include <login_cap.h>
 # define login_getpwclass(pw) login_getclass(pw->pw_class)
@@ -187,7 +195,7 @@ int getgrouplist(const char *, gid_t, gid_t *, int *);
 #endif
 
 #if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET)
-int BSDgetopt(int argc, char * const *argv, const char *opts);
+int BSDgetopt(int argc, char * const *argv, const char *opts) __THROW;
 #include "openbsd-compat/getopt.h"
 #endif