Commit Graph

684 Commits

Author SHA1 Message Date
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
Ingo Bürk
1522f58ef0
Merge pull request #261 from tylerbrazier/no-sloc
Remove SLOC comment from man page
2018-02-03 09:36:36 +01:00
Tyler Brazier
d35e0ab9b6 Remove SLOC comment from man page
This changed happened for the readme in
73620dc876
2018-02-02 13:05:46 -06:00
johcgt
d5c69a9d60 Treat zero battery capacity as "not available" (#259)
`print_battery_info` computes `batt_info.percentage_remaining` by
dividing batt_info.remaining by `full`. If `full` is `0` then the
battery remaining will be reported as "inf".

Before this, it tries to set `full` to either the design capacity or to
the last known good charge. It determines if these values are available
by checking whether their fields in `batt_info` are non-negative. As it
initialized `batt_info` with values of `-1`, a non-negative value
implies that something has provided a value.

`slurp_all_batteries` and `add_battery_info` however initialize these
fields to zero, so if these functions are called then
`batt_info.full_design` will always be used.

This means that on systems that don't provide a value for design
capacity the percentage remaining will be reported as "inf", unless the
user has set `last_full_capacity` to `true` in their `i3status.conf`.

This patch changes `print_battery_info` to expect values for the battery
capacity to be strictly greater than zero. This seems reasonable as a
battery with a capacity of zero isn't useful.

An alternative solution would be to change `slurp_all_batteries` and
`add_battery_info` to initialize `batt_info` with `-1`, as
`print_battery_info` does. This is less appealing as `add_battery_info`
is accumulating the values, so using `-1` would introduce off-by-one
errors without additional code to avoid them.
2018-01-28 15:37:51 +01:00
Ingo Bürk
ef8f9ddcd7
Merge pull request #255 from eplanet/update_readme
Get rid of the SLOC comment
2017-12-12 18:07:19 +01:00