Skip to content

Commit

Permalink
Merge pull request #2032 from jimklimov/issue-1279-nonfunctional
Browse files Browse the repository at this point in the history
Cherry-pick nonfunctional improvements from PR #1652 (issue #1279)
  • Loading branch information
jimklimov authored Sep 2, 2023
2 parents 350865c + dd30c67 commit e3fb50d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,10 @@ if (p == NULL || *p != '\0') return 1])],
)])
AS_IF([test x"${ac_cv_func_strptime}" = xyes],
[AC_DEFINE([HAVE_STRPTIME], 1, [defined if standard library has, and C standard allows, the strptime(s1,s2,tm) method])],
[AC_MSG_WARN([Optional C library routine strptime not found; a fallback implementation will be built in])]
[AC_MSG_WARN([Optional C library routine strptime not found; try adding _GNU_SOURCE; a fallback implementation will be built in])]
)
dnl Note: per Linux headers, this may need __USE_XOPEN (features.h)
dnl which is enabled by _XOPEN_SOURCE via _GNU_SOURCE on the platform.
AM_CONDITIONAL([HAVE_STRPTIME], [test x"${ac_cv_func_strptime}" = "xyes"])

AC_CACHE_CHECK([for clock_gettime(CLOCK_MONOTONIC,ts)],
Expand Down
2 changes: 2 additions & 0 deletions drivers/libhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ static double logical_to_physical(HIDData_t *Data, long logical)
if ((Data->PhyMax <= Data->PhyMin) || (Data->LogMax <= Data->LogMin))
{
/* this should not really happen */
upsdebugx(5, "Max was not greater than Min, returning logical value as is");
return (double)logical;
}

Expand Down Expand Up @@ -859,6 +860,7 @@ static long physical_to_logical(HIDData_t *Data, double physical)
if ((Data->PhyMax <= Data->PhyMin) || (Data->LogMax <= Data->LogMin))
{
/* this should not really happen */
upsdebugx(5, "Max was not greater than Min, returning physical value as is");
return (long)physical;
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,17 @@ void storeval(const char *var, char *val)
* addvar() in a driver codebase.
*/
if (!strncasecmp(var, "override.", 9)) {
/* NOTE: No regard for VAR_SENSITIVE here */
dstate_setinfo(var+9, "%s", val);
dstate_setflags(var+9, ST_FLAG_IMMUTABLE);
dparam_setinfo(var, val);
return;
}

if (!strncasecmp(var, "default.", 8)) {
/* NOTE: No regard for VAR_SENSITIVE here */
dstate_setinfo(var+8, "%s", val);
dparam_setinfo(var, val);
return;
}

Expand Down

0 comments on commit e3fb50d

Please sign in to comment.