summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/bsdfan/Makefile3
-rw-r--r--sysutils/bsdfan/files/patch-system.c31
2 files changed, 31 insertions, 3 deletions
diff --git a/sysutils/bsdfan/Makefile b/sysutils/bsdfan/Makefile
index 0a3ad6913b6f..caa9dfd6ebde 100644
--- a/sysutils/bsdfan/Makefile
+++ b/sysutils/bsdfan/Makefile
@@ -21,9 +21,6 @@ MAKE_ARGS= MANDIR=${PREFIX}/share/man/man
PLIST_FILES= bin/bsdfan share/man/man1/bsdfan.1.gz \
@sample\ etc/bsdfan.conf.sample
-post-patch:
- @${REINPLACE_CMD} -e 's,getTemp(,&void,' ${WRKSRC}/system.c
-
post-install:
${INSTALL_DATA} ${WRKSRC}/bsdfan.conf \
${STAGEDIR}${PREFIX}/etc/bsdfan.conf.sample
diff --git a/sysutils/bsdfan/files/patch-system.c b/sysutils/bsdfan/files/patch-system.c
new file mode 100644
index 000000000000..746330371302
--- /dev/null
+++ b/sysutils/bsdfan/files/patch-system.c
@@ -0,0 +1,31 @@
+--- system.c.orig 2018-01-12 16:11:08 UTC
++++ system.c
+@@ -10,7 +10,7 @@
+ #include "system.h"
+
+ #define INVALID_MODE_ERROR "Invalid fan mode"
+-#define PERMISSION_ERROR "Not enough permissions"
++#define FAN_SYSCTL_NODE "dev.acpi_ibm.0.fan"
+ #define KELVIN_TO_CELSIUS(t) ((t-2732+5)/10)
+
+ static int idx_cur_level;
+@@ -30,8 +30,8 @@ setFan(int mode, const struct Level *levels)
+ case MANUAL:
+ case AUTO:
+ /*set fan in manual mode*/
+- if (sysctlbyname("dev.acpi_ibm.0.fan",NULL,NULL,&mode,sizeof(int)) == -1)
+- err(EX_NOPERM, PERMISSION_ERROR);
++ if (sysctlbyname(FAN_SYSCTL_NODE,NULL,NULL,&mode,sizeof(int)) == -1)
++ err(EX_NOPERM, FAN_SYSCTL_NODE);
+
+ if (mode == AUTO)
+ break;
+@@ -86,7 +86,7 @@ levelDown(const struct Level *levels)
+ }
+
+ int
+-getTemp()
++getTemp(void)
+ {
+ int temp[8]={0};
+ size_t len = 8*sizeof(int);