summaryrefslogtreecommitdiff
path: root/sysutils/nut-devel/files
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2020-10-22 05:29:37 +0000
committerCy Schubert <cy@FreeBSD.org>2020-10-22 05:29:37 +0000
commit0222ac0b07c16077f3b4d5155d38d7b31849eec3 (patch)
treeb0f597c75221a7f4f763599a58769945f0f798b6 /sysutils/nut-devel/files
parent- Update to 2.5 (diff)
Revert upstream 73c8644. It results in a usbhid-ups bus fault.
Upstream issue: https://github.com/networkupstools/nut/issues/835
Notes
Notes: svn path=/head/; revision=552928
Diffstat (limited to 'sysutils/nut-devel/files')
-rw-r--r--sysutils/nut-devel/files/patch-drivers_main.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sysutils/nut-devel/files/patch-drivers_main.c b/sysutils/nut-devel/files/patch-drivers_main.c
new file mode 100644
index 000000000000..ff3af4909dd3
--- /dev/null
+++ b/sysutils/nut-devel/files/patch-drivers_main.c
@@ -0,0 +1,44 @@
+diff --git drivers/main.c drivers/main.c
+old mode 100755
+new mode 100644
+index f53322e2..0b6759dd
+--- drivers/main.c
++++ drivers/main.c
+@@ -607,9 +607,9 @@ int main(int argc, char **argv)
+
+ become_user(new_uid);
+
+- /* Only switch to statepath if we're not powering off or just dumping data, for discovery */
++ /* Only switch to statepath if we're not powering off */
+ /* This avoid case where ie /var is umounted */
+- if ((!do_forceshutdown) && (dump_data < 0) && (chdir(dflt_statepath())))
++ if ((!do_forceshutdown) && (chdir(dflt_statepath())))
+ fatal_with_errno(EXIT_FAILURE, "Can't chdir to %s", dflt_statepath());
+
+ /* Setup signals to communicate with driver once backgrounded. */
+@@ -642,11 +642,8 @@ int main(int argc, char **argv)
+ sleep(5);
+ }
+
+- /* Only write pid if we're not just dumping data, for discovery */
+- if (dump_data < 0) {
+- pidfn = xstrdup(buffer);
+- writepid(pidfn); /* before backgrounding */
+- }
++ pidfn = xstrdup(buffer);
++ writepid(pidfn); /* before backgrounding */
+ }
+
+ /* clear out callback handler data */
+@@ -701,10 +698,7 @@ int main(int argc, char **argv)
+ }
+
+ /* now we can start servicing requests */
+- /* Only write pid if we're not just dumping data, for discovery */
+- if (dump_data < 0) {
+- dstate_init(progname, upsname);
+- }
++ dstate_init(progname, upsname);
+
+ /* The poll_interval may have been changed from the default */
+ dstate_setinfo("driver.parameter.pollinterval", "%d", poll_interval);