Commit Graph

688 Commits

Author SHA1 Message Date
Felix Buehler
d099a907f6 fix clang errors 2018-07-13 15:11:43 +02:00
Felix Buehler
a40d7d928f switch to clang 3.8 & ignore sort oder of includes 2018-07-08 13:48:28 +02:00
Ingo Bürk
c5ad20bf50
Merge pull request #294 from Stunkymonkey/remove_memory_discussion
forgot to remove memory discussion from man page (it is implemented)
2018-06-30 06:52:58 +02:00
Felix Buehler
4e62a853ee forgot to remove memory discussion from man page (it is implemented) 2018-06-30 00:52:59 +02:00
Ingo Bürk
302966374b
Merge pull request #292 from Stunkymonkey/format_quality
add format_quality option in wireless
2018-06-29 23:10:53 +02:00
Felix Buehler
4ea804b751 add format_quality option in wireless 2018-06-29 22:56:09 +02:00
Ingo Bürk
78c0a53c45
Merge pull request #293 from Stunkymonkey/hide_seconds_battery
hide seconds in battery by default
2018-06-29 22:49:52 +02:00
Ingo Bürk
a916481aab
Merge pull request #291 from duskCoder/cap_net_admin
Stop requiring CAP_NET_ADMIN
2018-06-29 22:43:39 +02:00
Felix Buehler
50b899ba42 hide seconds in battery by default 2018-06-29 14:37:48 +02:00
Olivier Gayot
03c8908ec6 Stop requiring CAP_NET_ADMIN
Since the following commit in the Linux kernel tree

  0fdc100bdc4b ethtool: allow non-netadmin to query settings

it is no longer necessary to have the CAP_NET_ADMIN capability to query
a device speed using ioctl(..., SIOCETHTOOL) in conjonction with the
ETHTOOL_GSET ethtool command.

The mentioned commit landed first in the 2.6.37 version of the Kernel.
This version is no longer maintained nowdays.

Since it is not necessary anymore, it is strongly prefered from a
security standpoint to drop the CAP_NET_ADMIN capability from the
binary.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-25 11:53:05 +02:00
Ingo Bürk
4d3344ab9c
Merge pull request #290 from duskCoder/changes
Fix potential issues & avoid unnecessary instructions
2018-06-22 13:55:09 +02:00
Olivier Gayot
c221b4d331 Prevent potential crash if glob() fails
Calling globfree(NULL) is undefined behaviour. In Linux (glibc), it
results in a segmentation fault.

It is also undefined behaviour to call globfree(&pglob) if a previous
call to glob(&pglob) returned an error.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
445b1925e3 Fix potential memory leak on Linux
The function slurp_all_batteries(), on Linux, allocates memory
dynamically

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
c64195d147 Fix invalid handling of glob() errors on Linux
The manual of glob(3) says that the function returns 0 on successful
completion. Any other integer value should be considered an error, not
only negative integers.

In practice, *BSD systems use negative values but Linux uses positive
integers.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
95c068358a Fix use of undefined macro __OpenBSD__
Compiling on Linux with -Wundef produces the following warning:

  warning: "__OpenBSD__" is not defined, evaluates to 0 [-Wundef]

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
a6dd14c8c6 Avoid assigning a new value to a var before using the old value
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
598b76cc53 Make sure the arguments passed to printf/die(...) match the format
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 14:20:17 +02:00
Olivier Gayot
ca8c3e7337 No longer use a temporary buffer in the die() function
Before the following change

  f947d0a Breaks configfiles! Major refactoring of i3status, see below

The die(fmt, ...) function was outputting the reason to the status bar
in addition to stderr. For this reason, it was meaningful to create a
temporary string according to the format string and then passing it
around to the different functions.

Nowadays, we only display the error message to stderr so calling
fprintf(stderr, ...) is much simpler.

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-20 11:01:59 +02:00
Ingo Bürk
64fd6e1047
Merge pull request #289 from bebehei/testsuite
Testsuite
2018-06-20 08:39:59 +02:00
Benedikt Heine
bffc9ed962 Show differing results, if testcase fails 2018-06-19 17:17:51 +02:00
Benedikt Heine
a073acd406 Run all travis tests and expose the final result as exit code 2018-06-19 17:17:51 +02:00
Benedikt Heine
adc9348e80 Expose the testsuite in the Makefile 2018-06-19 17:17:51 +02:00
Benedikt Heine
bc29d468ca Fail the tests, if i3status actually crashes 2018-06-19 16:47:02 +02:00
Ingo Bürk
f300f6e466
Merge pull request #287 from eplanet/emeric/man_typo
Fix man typo
2018-06-16 14:49:09 +02:00
eplanet
5b4eb1069d Fix man typo 2018-06-14 22:09:03 +02:00
Ingo Bürk
ac78e1abe3
Merge pull request #286 from duskCoder/#283
Fix issue #283 (shown IP belonging to wrong network interface)
2018-06-11 22:18:53 +02:00
Olivier Gayot
451ff9be0b Fix shown IP address belonging to wrong interface
The following commit:

  6a75ea9 Show IP address when address has a label

introduced a way to show the IP address of an interface when a label is
associated to the IP.

When a label is associated to an IP, the structure returned by
getifaddrs() has the label concatenated to the interface name in the
.ifa_name field as in the following example:

    struct ifaddrs ifaddr = {
       .ifa_name = "eth0:mylabel",
    };

As a consequence, using a strict comparison between the interface name
and the .ifa_name field yields a falsy result. However, checking if the
.ifa_name starts with the interface name (e.g. eth0) does not work
either because other network interfaces can have a name which starts
with eth0.

This commit solves the issue by stripping out the optional label from
the .ifa_name field before making a strict comparison with the interface
name.

Fix #283

Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-11 22:06:57 +02:00
Olivier Gayot
99a6fb5e49 Simplify the algorithm used to determine the IP address
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
2018-06-04 19:59:09 +02:00
Ingo Bürk
9f08fe297a
Merge pull request #282 from Stunkymonkey/mem-support
fix wrong memory-documentation
2018-05-22 06:57:45 +02:00
Felix Buehler
c7253ac5e4 fix wrong memory-documentation 2018-05-22 02:07:28 +02:00
Ingo Bürk
b850f5852d
Merge pull request #270 from Stunkymonkey/mem-support
initial support of memory-usage for linux
2018-05-19 22:08:42 +02:00
Orestis
ffe41cc944
Merge pull request #281 from eplanet/fix_warnings
Fix MacOS build
2018-05-15 14:46:06 +03:00
eplanet
9a8106fab9 Fix MacOS build 2018-05-15 13:34:36 +02:00
Michael Stapelberg
c983ff96f2 release v2.12 2018-05-11 11:07:22 +02:00
Benedikt Heine
cba8f55938 Simplify the memory thresholds 2018-05-04 18:46:59 +02:00
Benedikt Heine
7839e93c9b Rename ram variables consistently 2018-05-04 18:46:38 +02:00
Felix Buehler
c55754542e Implement support for memory-usage on Linux 2018-04-11 22:36:41 +02:00
Ingo Bürk
82d25dc362
Merge pull request #275 from winks/patch-2
Fix NULL value on OpenBSD when there is no acpitz0
2018-04-08 15:53:19 +02:00
Florian Anderiasch
46b5c264d1 Fix NULL value on OpenBSD when there is no acpitz0
Using %degrees on OpenBSD resulted in garbage values if sysctl doesn't
know about any cpu temperature sensors.
2018-04-06 19:56:55 +02:00
Ingo Bürk
199a6a2713
Merge pull request #213 from dlrobertson/addr_description
Show IP address when address has a label
2018-03-29 12:50:56 +02:00
Dan Robertson
6a75ea9aea
Show IP address when address has a label
If an address has been added with a label, ensure the correct address is
shown.
2018-03-29 10:46:36 +00:00
Ingo Bürk
5abed82419
Merge pull request #264 from foutaise/master
Make iface_type() work on FreeBSD
2018-03-27 09:27:43 +02:00
Ingo Bürk
4345fa9d97
Merge branch 'master' into master 2018-03-27 09:26:55 +02:00
Ingo Bürk
279e2fccf4
Merge pull request #251 from tomaskrizek/man-eth-wireless-format
man: explicitly use format_up/format_down in ethernet, wireless conf
2018-03-27 09:10:51 +02:00
Ingo Bürk
3aec438a51
Merge pull request #243 from jasperla/fei_error
Remove overly aggressive #error
2018-03-27 09:07:53 +02:00
Ingo Bürk
2cb0ffa01a
Merge pull request #266 from moreais/master
OpenBSD: fix volume display on some hardware
2018-02-12 16:32:01 +01:00
Carlin Bingham
5b416d4ac0 OpenBSD: fix volume display on some hardware
On some hardware the AUDIO_MIXER_READ ioctl requires the current number
of channels to be set, and the mute device found needs to be checked if
it belongs to the master output device.
2018-02-13 02:12:04 +13:00
Gerome Fournier
9212ee658b Make iface_type() work on FreeBSD 2018-02-07 11:26:34 +01:00
Ingo Bürk
0880b0ec03
Merge pull request #262 from foutaise/master
Add check for interval value
2018-02-06 12:56:53 +01:00
foutaise
e23eea9438 Add check for interval value 2018-02-06 12:30:04 +01:00