mbpfan-josie

Fixes #14 and enhances Readme.md

8ed60e90247037f5a60afbce1c0860a152831d57
Daniel Graziotin <dgraziotin@task3.cc> · 2012-08-22T15:53 · browse files at this commit

parents: fcf18f5

diff --git a/Makefile b/Makefile
index cb26497..7e40233 100644
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,10 @@ tests:
 	make install
 	sudo /usr/sbin/mbpfan -f -v -t
 
+uninstall:
+	rm /usr/sbin/mbpfan
+	rm /etc/mbpfan.conf
+
 install:
 	make
 	cp $(EXE) /usr/sbin
diff --git a/README.md b/README.md
index 06212d1..29ea2df 100644
--- a/README.md
+++ b/README.md
@@ -56,32 +56,38 @@ sudo service mbpfan start
 
 Starting at boot
 ----------------
-An init file suitable for /lib/lsb/init-functions (Debian & Ubuntu for sure)
+**Ubuntu**
+For upstart based init systems (Ubuntu), an example upstart job has been
+provided for use in place of the LSB-style init script. 
+To use, execute:
+	sudo cp mbpfan.upstart /etc/init/mbpfan.conf
+	sudo start mbpfan
+
+**Debian**
+An init file suitable for /lib/lsb/init-functions (Debian) 
 is located in the main folder of the source files, called mbpfan.init.debian
 Rename it to mbpfan, give it execution permissions (chmod +x mbpfan)
 and move it to /etc/init.d
 Then, add it to the default runlevels with sudo update-rc.d mbpfan defaults
 
-Additionally, an init file suitable for /etc/rc.d/init.d/functions
+**Redhat, CentOS, Fedora**
+An init file suitable for /etc/rc.d/init.d/functions
 (RHEL/CentOS & Fedora) is also located at the same place, this file is called
 mbpfan.init.redhat. Also rename it to mbpfan, give it execution permissions
 and move it to /etc/init.d
 To add the script to the default runlevels, run the following as root:
 chkconfig --level 2345 mbpfan on && chkconfig --level 016 mbpfan off
 
-For upstart based init systems (Ubuntu), an example upstart job has been
-provided for use in place of the LSB-style init script. To use, execute
-as root:
-cp mbpfan.upstart /etc/init/mbpfan.conf
-start mbpfan
+**systemd**
 As a special bonus, a service file for systemd is also included. To use it,
 execute the following as root:
-cp mbpfan.service /usr/lib/systemd/system
-ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service
-systemctl daemon-reload
-systemctl start mbpfan.service
+sudo cp mbpfan.service /usr/lib/systemd/system
+sudo ln -s /usr/lib/systemd/system/mbpfan.service /etc/systemd/system/mbpfan.service
+sudo systemctl daemon-reload
+sudo systemctl start mbpfan.service
+
 To start the service automatically at boot, also execute the following:
-systemctl enable mbpfan.service
+sudo systemctl enable mbpfan.service
 
 
 Usage
diff --git a/src/mbpfan.c b/src/mbpfan.c
index 5cc30de..1953659 100644
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -78,7 +78,7 @@ t_sensors *retrieve_sensors()
     const char *path_end = "_input";
 
     int path_size = strlen(path_begin) + strlen(path_end) + 2;
-    char number[1];
+    char number[2];
     sprintf(number,"%d",0);
 
     int i = 0;
@@ -132,7 +132,7 @@ void find_fans(t_sensors* sensors)
 
     int path_min_size = strlen(path_begin) + strlen(path_output_end) + 2;
     int path_man_size = strlen(path_begin) + strlen(path_man_end) + 2;
-    char number[1];
+    char number[2];
     sprintf(number,"%d",0);
 
     int n_sensors = 0;