Skip to content

Commit 2264164

Browse files
authored
Merge febd9b2 into b30d183
2 parents b30d183 + febd9b2 commit 2264164

22 files changed

+66
-53
lines changed

Jenkinsfile-dynamatrix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import org.nut.dynamatrix.*;
117117
//'stageNameFunc': null,
118118
//'dynamatrixAxesLabels': [~/^OS_.+/, 'MAKE'],
119119
'dynamatrixAxesLabels': ['OS_FAMILY', 'OS_DISTRO', 'MAKE'],
120+
'excludeCombos': [[~/OS_DISTRO=netbsd\./]],
120121
'single': '( if [ x"\${MAKE-}" = x ]; then echo "WARNING: MAKE is somehow unset, defaulting!" >&2; MAKE=make; fi; \${MAKE} -j 4 shellcheck )',
121122
'multi': '(cd tests && SERVICE_FRAMEWORK="selftest" SHELL_PROGS="$SHELL_PROGS" ./nut-driver-enumerator-test.sh )',
122123
'multiLabel': 'SHELL_PROGS',

clients/cgilib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static void cgilib_err(const char *errmsg)
162162

163163
int checkhost(const char *host, char **desc)
164164
{
165-
char fn[NUT_PATH_MAX];
165+
char fn[NUT_PATH_MAX + 1];
166166
PCONF_CTX_t ctx;
167167

168168
if (!host)

clients/upssched.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,10 +970,10 @@ static void start_daemon(TYPE_FD lockfd)
970970
DWORD timeout_ms;
971971
HANDLE rfds[32];
972972

973-
char module[NUT_PATH_MAX];
973+
char module[NUT_PATH_MAX + 1];
974974
STARTUPINFO sinfo;
975975
PROCESS_INFORMATION pinfo;
976-
if (!GetModuleFileName(NULL, module, NUT_PATH_MAX)) {
976+
if (!GetModuleFileName(NULL, module, sizeof(module))) {
977977
fatal_with_errno(EXIT_FAILURE, "Can't retrieve module name");
978978
}
979979
memset(&sinfo,0,sizeof(sinfo));
@@ -1439,7 +1439,7 @@ static void upssched_err(const char *errmsg)
14391439

14401440
static void checkconf(void)
14411441
{
1442-
char fn[NUT_PATH_MAX];
1442+
char fn[NUT_PATH_MAX + 1];
14431443
PCONF_CTX_t ctx;
14441444
int numerrors = 0;
14451445

clients/upsset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static void upsset_hosts_err(const char *errmsg)
194194
/* this defaults to wherever we are now, ups and function-wise */
195195
static void do_pickups(const char *currfunc)
196196
{
197-
char hostfn[NUT_PATH_MAX];
197+
char hostfn[NUT_PATH_MAX + 1];
198198
PCONF_CTX_t ctx;
199199

200200
snprintf(hostfn, sizeof(hostfn), "%s/hosts.conf", confpath());
@@ -1020,7 +1020,7 @@ static void upsset_conf_err(const char *errmsg)
10201020
/* see if the user has confirmed their cgi directory's secure state */
10211021
static void check_conf(void)
10221022
{
1023-
char fn[NUT_PATH_MAX];
1023+
char fn[NUT_PATH_MAX + 1];
10241024
PCONF_CTX_t ctx;
10251025

10261026
snprintf(fn, sizeof(fn), "%s/upsset.conf", confpath());

clients/upsstats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ static void parse_line(const char *buf)
846846

847847
static void display_template(const char *tfn)
848848
{
849-
char fn[NUT_PATH_MAX], buf[LARGEBUF];
849+
char fn[NUT_PATH_MAX + 1], buf[LARGEBUF];
850850

851851
snprintf(fn, sizeof(fn), "%s/%s", confpath(), tfn);
852852

@@ -965,7 +965,7 @@ static void upsstats_hosts_err(const char *errmsg)
965965

966966
static void load_hosts_conf(void)
967967
{
968-
char fn[NUT_PATH_MAX];
968+
char fn[NUT_PATH_MAX + 1];
969969
PCONF_CTX_t ctx;
970970

971971
snprintf(fn, sizeof(fn), "%s/hosts.conf", CONFPATH);

common/common.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ const char *suggest_doc_links(const char *progname, const char *progconf) {
672672
size_t i;
673673

674674
for (i = 0; buf2[i]; i++) {
675-
buf2[i] = tolower(buf2[i]);
675+
buf2[i] = tolower((unsigned char)(buf2[i]));
676676
}
677677

678678
if ((s = strstr(buf2, ".exe")) && strcmp(buf2, "nut.exe"))
@@ -1012,7 +1012,7 @@ char * getprocname(pid_t pid)
10121012
*/
10131013
char *procname = NULL;
10141014
size_t procnamelen = 0;
1015-
char pathname[NUT_PATH_MAX];
1015+
char pathname[NUT_PATH_MAX + 1];
10161016
struct stat st;
10171017

10181018
#ifdef WIN32
@@ -1469,7 +1469,7 @@ int compareprocname(pid_t pid, const char *procname, const char *progname)
14691469
size_t procbasenamelen = 0, progbasenamelen = 0;
14701470
/* Track where the last dot is in the basename; 0 means none */
14711471
size_t procbasenamedot = 0, progbasenamedot = 0;
1472-
char procbasename[NUT_PATH_MAX], progbasename[NUT_PATH_MAX];
1472+
char procbasename[NUT_PATH_MAX + 1], progbasename[NUT_PATH_MAX + 1];
14731473

14741474
if (checkprocname_ignored(__func__)) {
14751475
ret = -3;
@@ -1661,7 +1661,7 @@ int checkprocname(pid_t pid, const char *progname)
16611661
depending on the .exe path */
16621662
char * getfullpath(char * relative_path)
16631663
{
1664-
char buf[NUT_PATH_MAX];
1664+
char buf[NUT_PATH_MAX + 1];
16651665
if ( GetModuleFileName(NULL, buf, sizeof(buf)) == 0 ) {
16661666
return NULL;
16671667
}
@@ -1682,7 +1682,7 @@ char * getfullpath(char * relative_path)
16821682
void writepid(const char *name)
16831683
{
16841684
#ifndef WIN32
1685-
char fn[NUT_PATH_MAX];
1685+
char fn[NUT_PATH_MAX + 1];
16861686
FILE *pidf;
16871687
mode_t mask;
16881688

@@ -2217,7 +2217,7 @@ int str_add_unique_token(char *tgt, size_t tgtsize, const char *token,
22172217
#ifndef WIN32
22182218
int sendsignal(const char *progname, int sig, int check_current_progname)
22192219
{
2220-
char fn[NUT_PATH_MAX];
2220+
char fn[NUT_PATH_MAX + 1];
22212221

22222222
snprintf(fn, sizeof(fn), "%s/%s.pid", rootpidpath(), progname);
22232223

@@ -3236,7 +3236,7 @@ const char * rootpidpath(void)
32363236
/* Die with a standard message if socket filename is too long */
32373237
void check_unix_socket_filename(const char *fn) {
32383238
size_t len = strlen(fn);
3239-
size_t max = NUT_PATH_MAX;
3239+
size_t max = NUT_PATH_MAX; /* no +1 here */
32403240
#ifndef WIN32
32413241
struct sockaddr_un ssaddr;
32423242
max = sizeof(ssaddr.sun_path);
@@ -4036,7 +4036,7 @@ static char * get_libname_in_dir(const char* base_libname, size_t base_libname_l
40364036
DIR *dp;
40374037
struct dirent *dirp;
40384038
char *libname_path = NULL, *libname_alias = NULL;
4039-
char current_test_path[NUT_PATH_MAX];
4039+
char current_test_path[NUT_PATH_MAX + 1];
40404040

40414041
upsdebugx(3, "%s('%s', %" PRIuSIZE ", '%s', %i): Entering method...",
40424042
__func__, base_libname, base_libname_length, dirname, index);

common/nutstream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static const char* getTmpDirPath() {
244244

245245
#ifdef WIN32
246246
/* Suggestions from https://sourceforge.net/p/mingw/bugs/666/ */
247-
static char pathbuf[NUT_PATH_MAX];
247+
static char pathbuf[NUT_PATH_MAX + 1];
248248
int i;
249249
#endif
250250

@@ -330,7 +330,7 @@ NutFile::NutFile(anonymous_t):
330330
/* Suggestions from https://sourceforge.net/p/mingw/bugs/666/ because
331331
* msvcrt tmpfile() uses C: root dir and lacks permissions to actually
332332
* use it, and mingw tends to call that OS method so far */
333-
char filename[NUT_PATH_MAX];
333+
char filename[NUT_PATH_MAX + 1];
334334
memset(filename, 0, sizeof(filename));
335335

336336
GetTempFileNameA(m_tmp_dir.c_str(), "nuttemp", 0, filename);

common/upsconf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void upsconf_err(const char *errmsg)
7575
*/
7676
int read_upsconf(int fatal_errors)
7777
{
78-
char fn[NUT_PATH_MAX];
78+
char fn[NUT_PATH_MAX + 1];
7979
PCONF_CTX_t ctx;
8080

8181
ups_section = NULL;

common/wincompat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ static const char *named_pipe_name=NULL;
498498
void pipe_create(const char * pipe_name)
499499
{
500500
BOOL ret;
501-
char pipe_full_name[NUT_PATH_MAX];
501+
char pipe_full_name[NUT_PATH_MAX + 1];
502502

503503
/* save pipe name for further use in pipe_connect */
504504
if (pipe_name == NULL) {

docs/config-prereqs.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ Note that `PATH` for builds on NetBSD should include `local` and
10531053
------
10541054

10551055
NOTE: You may want to reference `ccache` even before all that,
1056+
e.g. in the system-wide `/etc/profile` or build-user's `~/.profile`,
10561057
as detailed below:
10571058

10581059
------
@@ -1071,7 +1072,7 @@ you can work around by `make MKDIRPROG="mkdir -p" install -j 8` for example.
10711072

10721073
------
10731074
:; pkgin install \
1074-
git perl curl \
1075+
git perl curl mozilla-rootcerts-openssl \
10751076
make gmake autoconf automake libltdl libtool \
10761077
cppcheck \
10771078
pkgconf \
@@ -1161,8 +1162,17 @@ binaries and into `/usr/lib/ccache`:
11611162
)
11621163
------
11631164

1164-
NOTE: For Jenkins agents, also need to `pkgin install openjdk17` (will be
1165-
in `JAVA_HOME=/usr/pkg/java/openjdk17`).
1165+
NOTE: For Jenkins agents, also need to `pkgin install openjdk21` (will be
1166+
in `JAVA_HOME=/usr/pkg/java/openjdk21`). Note that the location may be not
1167+
exposed in `PATH` by default, so you may want to edit your system-wide
1168+
`/etc/profile` or build user's `~/.profile` with:
1169+
1170+
------
1171+
JAVA_HOME="/usr/pkg/java/openjdk21"
1172+
export JAVA_HOME
1173+
PATH="${JAVA_HOME}/bin:${PATH}"
1174+
export PATH
1175+
------
11661176

11671177
OpenIndiana as of releases 2021.10 to 2024.04
11681178
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)