Thomas Hindoe Paaboel Andersen
6f53e671aa
util: avoid double close of fd
...
We could end with a double close if we close the fd loop and flush_fd
fails. That would make us goto fail and there we close the fd once
again. This patch sets the fd to the return value for safe_close: -1
A fd with negative value will be ignored by the next call to
safe_close.
CID#996223
2014-10-09 00:19:57 +02:00
Thomas Hindoe Paaboel Andersen
13303f018d
sd-bus: remove unused variable
...
It is no longer used after d663f1b1a9
2014-10-07 00:00:21 +02:00
Thomas Hindoe Paaboel Andersen
0077776275
terminal: remove an unused initialization
2014-10-05 22:43:07 +02:00
Thomas Hindoe Paaboel Andersen
bdf7026e95
test: only use assert_se
...
The asserts used in the tests should never be allowed to be
optimized away
2014-10-04 23:55:35 +02:00
Thomas Hindoe Paaboel Andersen
1c92ff85b7
bootchart: use 'n/a' if PRETTY_NAME is not found
...
Spotted with coverity. If parsing both /etc/os-release and
/usr/lib/os-release fails then null would be passed on. The calls
to parse the two files are allowed to fail. A empty /etc may not
have had the /etc/os-release symlink restored yet and we just
try again in the loop. If for whatever reason that does not happen
then we now pass on 'n/a' instead of null.
2014-10-03 08:31:53 -04:00
Thomas Hindoe Paaboel Andersen
2ad8887a12
test-barrier: add checks after the barrier constructor
...
Coverity seems to think that we can later end up with the "them"
fd having a negative value. Even after a succesful barrier_create.
Add some test to verify that the constructor went well. If coverity
still complains then it must mean that it thinks the the value is
overwritten later.
2014-10-03 04:04:42 +02:00
Thomas Hindoe Paaboel Andersen
94956f8fba
firstboot: silence coverity
...
CID#1237537
2014-10-02 21:37:33 +02:00
Thomas Hindoe Paaboel Andersen
cf4acf84c6
Remove repeated includes
...
In pty.c there was both an include of our pty.h and the system installed pty.h.
The latter contains only two functions openpty and forkpty. We use neither so
I assume it was a typo and removed it. We still compile and pass all tests.
2014-10-01 23:25:50 +02:00
Thomas Hindoe Paaboel Andersen
56a7dd42d3
gitignore: add test-set
2014-10-01 23:24:10 +02:00
Thomas Hindoe Paaboel Andersen
2b01a801f6
test-fileio: Remove dead check
...
t cannot be null here
2014-09-30 23:40:40 +02:00
Thomas Hindoe Paaboel Andersen
14c35ce7c1
test-date: don't fail test if log_max_level is higher than LOG_INFO
2014-09-30 23:40:40 +02:00
Thomas Hindoe Paaboel Andersen
59ae3a9573
test-path-util: fix a mem leak and avoid confusing coverity
...
Found with coverity. Fixes CID#1237754 and #1237790
2014-09-30 22:28:46 +02:00
Thomas Hindoe Paaboel Andersen
791a4fd837
vconsole: silence coverity
...
Let's silence coverity here too. There is not much to do if the
ioctls to copy the fonts and character maps should fail.
2014-09-30 21:27:54 +02:00
Thomas Hindoe Paaboel Andersen
5e90b6a978
test-bus-policy: silence coverity
...
Check if strjoin worked and also use _cleanup_free_ since we are
here.
Found with Coverity. Fixes CID#1241962
2014-09-28 18:48:33 +02:00
Thomas Hindoe Paaboel Andersen
e931d3f424
bootchart: check return of strftime
...
Found by coverity. Fixes: CID#996314 and #996312
2014-09-28 14:46:38 +02:00
Thomas Hindoe Paaboel Andersen
9bcf7507fa
bootchart: parse userinput with safe_atoi
...
Found by coverity. Fixes: CID#996409
2014-09-28 14:46:38 +02:00
Thomas Hindoe Paaboel Andersen
b748c7596f
shutdownd: clean up initialization of struct
...
No functional change. We just don't assign the value twice.
Found by coverity. Fixes: CID#1237616 and #1237617
2014-09-27 00:30:00 +02:00
Thomas Hindoe Paaboel Andersen
04c553e322
bus: remove unused check
...
strerror_r does not return null here and even if it did we would have
problems already at the preceding strlen call.
Found by coverity. Fixes: CID#1237770
2014-09-23 21:39:36 +02:00
Thomas Hindoe Paaboel Andersen
cbb452e7ef
test: warn if we could not parse the loop count argument
...
Found by coverity. Fixes: CID#1237512
2014-09-19 01:45:59 +02:00
Thomas Hindoe Paaboel Andersen
66a16e7e9f
nss: remove dead code
...
c > 0 is already guaranteed from earlier checks.
We go from
ms = ALIGN(l+1) +
sizeof(char*) +
(c > 0 ? c : 1) * ALIGN(alen) +
(c > 0 ? c+1 : 2) * sizeof(char*);
to
ms = ALIGN(l+1) +
sizeof(char*) +
c * ALIGN(alen) +
(c+1) * sizeof(char*);
to
ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
Found by coverity. Fixes: CID#1237570 and CID#1237610
2014-09-19 00:15:39 +02:00
Thomas Hindoe Paaboel Andersen
8c84621c25
sysv-generator: don't check first if hashmap contains the service name
...
Just test if hashmap_get returns null. hashmap_contains does exactly
same thing internally so this is slightly more efficient for the true
case.
Silences a coverity warning too. CID#1237648
2014-09-17 23:11:58 +02:00
Thomas Hindoe Paaboel Andersen
4eef5b7441
nss-resolve: remove dead code
...
ifindex < 0 was already checked before entering the loop
Found by coverity. Fixes: CID#1237609
2014-09-17 20:50:36 +02:00
Thomas Hindoe Paaboel Andersen
42646a8bf2
util: remove a unnecessary check
...
We only break out of the previous loop if fd >= 0 so there is no
use in checking it again.
Found by coverity. Fixes: CID#1237577
2014-09-16 23:03:50 +02:00
Thomas Hindoe Paaboel Andersen
cca0efb047
test: silence a coverity report
...
We check the actual contents of the file on the line after but we
might as well also check the number of bytes read here.
Found by coverity. Fixes: CID#1237521
2014-09-16 22:02:23 +02:00
Thomas Hindoe Paaboel Andersen
9169b9a8cc
terminal: sd_bus_error_get_errno returns positive errno
...
The 3 calls to sd_bus_error_get_errno appear to expect a negative
return value.
This patch negates the returned value so it matches the other error
cases in the 3 functions where sd_bus_error_get_errno is used.
2014-09-16 21:31:15 +02:00
Thomas Hindoe Paaboel Andersen
b49ffb29ed
sd-bus: sd_bus_message_get_errno should only return positive errno
...
sd_bus_message_get_errno can currently return either a number of
different poitive errno values (from bus-error-mapping), or a negative
EINVAL if passed null as parameter.
The check for null parameter was introduced in 40ca29a137
at the same as the function was renamed from bus_message_to_errno and
made public API. Before becoming public the function used to return
only negative values.
It is weird to have a function return both positive and negative errno
and it generally looks like a mistake. The function is guarded by the
--enable-kdbus flags so I wonder if we still have time to fix it up?
It does not have any documentation yet. However, except for a few details
it is just a convenient way to call sd_bus_error_get_errno which is documented
to return only positive errno.
This patch makes it return only positive errno and fixes up the two
calls to the function that tried to cope with both positive and negative
values.
2014-09-16 21:31:15 +02:00
Thomas Hindoe Paaboel Andersen
f70ca25ae0
man: sd_bus_error typo fix
2014-09-15 23:17:57 +02:00
Thomas Hindoe Paaboel Andersen
20755373b1
test: fix test of uid-range
...
The number of uid's in the range should be tested instead of written
directly.
The test still passes with the fix checks.
Found with Coverity. Fixes: CID#1237714 - 1237722
2014-09-14 22:47:21 +02:00
Thomas Hindoe Paaboel Andersen
86be3e1e65
sd-dhcp: fix test of magic cookie
...
The magic cookie is set in dhcp_message_init. Test the magic cookie
value intead of writing the last 3/4 of it directly.
Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735
2014-09-14 22:47:21 +02:00
Thomas Hindoe Paaboel Andersen
4d5e13a125
core: fix a potential mem leak
...
Found with Coverity. Fixes: CID#996438
2014-09-13 12:38:39 +02:00
Thomas Hindoe Paaboel Andersen
0ee9613d98
analyze: fix mem leak
...
Found with Coverity. Fixes: CID#1237756
2014-09-13 12:38:39 +02:00
Thomas Hindoe Paaboel Andersen
d725a138c5
analyze: avoid a null dereference
...
If we have an error in the early sd_bus_* calls then unit_times
will still be null.
Found with coverity. Fixes: CID#996464
2014-09-11 23:45:36 +02:00
Thomas Hindoe Paaboel Andersen
e926f6475d
firstboot: silence a warning
...
No change in behavoir as the fallthrough from ARG_COPY had already
set arg_copy_locale to true.
Found with coverity. Fixes: CID#1237622
2014-09-11 21:29:59 +02:00
Thomas Hindoe Paaboel Andersen
807d0cca2b
manager: use correct cleanup function
...
Close the dir instead of attempt to free it.
Introduced in 874310b7b6
Found with coverity. Fixes: CID#996368
2014-09-11 21:22:45 +02:00
Thomas Hindoe Paaboel Andersen
822a59607c
execute: silence warnings
...
Mark two function parameters as const
2014-09-08 22:10:36 +02:00
Thomas Hindoe Paaboel Andersen
120d578e5f
namespace: avoid posible use of uninitialized variable
2014-09-08 22:09:41 +02:00
Thomas Hindoe Paaboel Andersen
13f493dc9a
login: fix mem leak
2014-08-31 23:41:10 +02:00
Thomas Hindoe Paaboel Andersen
9e60277835
config-parser: fix mem leak
2014-08-31 23:25:34 +02:00
Thomas Hindoe Paaboel Andersen
e4c38cc36e
journal-remote: fix check if realloc failed
2014-08-31 23:25:30 +02:00
Thomas Hindoe Paaboel Andersen
00b333bb10
terminal: remove unused variable
2014-08-27 23:23:10 +02:00
Thomas Hindoe Paaboel Andersen
c46409021f
sysusers: initialize r
...
Needed for the stdin case where it could otherwise end up being used
uninitialized.
2014-08-19 23:27:44 +02:00
Thomas Hindoe Paaboel Andersen
5f02e26ca7
NEWS: typo fixes
2014-08-19 23:10:53 +02:00
Thomas Hindoe Paaboel Andersen
ac45dec934
remove unused variables
2014-08-19 22:55:42 +02:00
Thomas Hindoe Paaboel Andersen
a6a4f52889
networkctl: use safe_qsort in case no links are present
...
Unlikely to happen but still...
2014-08-16 23:49:36 +02:00
Thomas Hindoe Paaboel Andersen
f1e3bee216
sd-bus,log: remove unused variables
2014-08-16 00:32:21 +02:00
Thomas Hindoe Paaboel Andersen
bf1594f54e
resolved: initialize counter
...
introduced in: a407657425
2014-08-12 04:42:33 +02:00
Thomas Hindoe Paaboel Andersen
17a6dfa3be
bus-proxy: service_name_is_valid will never be < 0
2014-08-05 18:22:31 +02:00
Thomas Hindoe Paaboel Andersen
24fb7c1fa6
sysusers: isempty will never be < 0
...
looks like a typo from 1b99214789
2014-08-04 23:28:02 +02:00
Thomas Hindoe Paaboel Andersen
8e21100002
test: use fabs on doubles
2014-08-04 23:28:02 +02:00
Thomas Hindoe Paaboel Andersen
75cd513ef8
resolved: avoid possible dereference of null pointer
...
In dns_scope_make_reply_packet the structs q, answer, and soa can be
null. We should check for null before reading their fields.
2014-08-03 23:01:57 +02:00
Thomas Hindoe Paaboel Andersen
621ac3d2cc
sd-dhcp-server: avoid returning garbage value
...
Force renewing with a pool size of 0 would return the uninitialized r.
2014-08-03 20:42:59 +02:00
Thomas Hindoe Paaboel Andersen
c15fb62a73
sd-dhcp-server: check if r < 0
2014-08-03 20:42:59 +02:00
Thomas Hindoe Paaboel Andersen
be63641349
resolve-host: use correct format specifier
2014-08-03 13:19:24 +02:00
Thomas Hindoe Paaboel Andersen
e850d8e1ac
resolved: remove unused variables
2014-08-03 13:19:19 +02:00
Thomas Hindoe Paaboel Andersen
3f8916fb0d
terminal: add format attributes
2014-07-18 13:50:12 +02:00
Thomas Hindoe Paaboel Andersen
41cb81eab9
terminal: silence warning
2014-07-18 13:32:40 +02:00
Thomas Hindoe Paaboel Andersen
0204152684
test-tables: fix build-scan
2014-07-17 23:54:12 +02:00
Thomas Hindoe Paaboel Andersen
962225baa8
resolved: silence warnings
...
No need to write to r here since it will be overwritten as the first
step in parse_fail.
2014-07-17 21:12:39 +02:00
Thomas Hindoe Paaboel Andersen
99dfe1345c
test-pty: silence a warning
2014-07-17 20:23:53 +02:00
Thomas Hindoe Paaboel Andersen
f12ea7dad0
resolved: remove unused variable
2014-07-17 19:59:47 +02:00
Thomas Hindoe Paaboel Andersen
3f2b585466
test-compress-benchmark: add missing % before PRIu64 format
2014-07-16 08:59:13 +02:00
Thomas Hindoe Paaboel Andersen
eda8090ba9
test-socket-util: silence warnings
2014-07-16 08:52:11 +02:00
Thomas Hindoe Paaboel Andersen
337ede5693
networkd: remove unused variable
2014-07-15 20:38:49 +02:00
Thomas Hindoe Paaboel Andersen
f5a4b0d353
dropin: add format attribute and fix a wrong caller
2014-07-07 22:20:56 +02:00
Thomas Hindoe Paaboel Andersen
cd4ba18a84
coredump: vacuum - fix calculation of 10% of fs size for MaxUse
2014-07-01 23:49:56 +02:00
Thomas Hindoe Paaboel Andersen
926695f1b5
sd-dhcp6-client: check return value
...
Checking the return values seems to have been forgotten in
ed6ee21953
2014-07-01 23:46:51 +02:00
Thomas Hindoe Paaboel Andersen
ce1dde29b9
typo fixes
2014-07-01 21:12:05 +02:00
Thomas Hindoe Paaboel Andersen
fcba63a846
man: file-hierarchy - typo fixes
2014-06-30 22:54:21 +02:00
Thomas Hindoe Paaboel Andersen
908c32e0f3
man: daemon - typo fix
2014-06-30 22:38:17 +02:00
Thomas Hindoe Paaboel Andersen
d0c8806d4a
coredumpctl: fix potential deref of null pointer
2014-06-27 00:17:58 +02:00
Thomas Hindoe Paaboel Andersen
7849c2acd4
coredump: make sure variable is set if uncompressed
...
reorder the code so the fstat is done before we can jump to
uncompressed
2014-06-27 00:17:58 +02:00
Thomas Hindoe Paaboel Andersen
de8f6e5463
coredumpctl: remove unused variable
2014-06-26 23:16:58 +02:00
Thomas Hindoe Paaboel Andersen
2bb9a7a286
coredump: fix debug message
...
typo from 347272731e
2014-06-26 23:16:58 +02:00
Thomas Hindoe Paaboel Andersen
260ad50f5b
sysv-generator: fix incorect ordering of Wants
2014-06-26 00:37:26 +02:00
Thomas Hindoe Paaboel Andersen
d171ed1c50
sysv-generator: rename PidFile to PIDFile
...
Spotted by Alexey Shabalin
2014-06-24 23:07:48 +02:00
Thomas Hindoe Paaboel Andersen
c8b32e11ee
consistently order cleanup attribute before type
2014-06-22 00:45:15 +02:00
Thomas Hindoe Paaboel Andersen
88675ae97c
sd-dhcp-server: remove unused cleanup function
...
Removes _cleanup_dhcp_lease_free_. While the automatic cleanup
functions are great to have this one is never used and causes
a warning in clang.
2014-06-20 19:32:51 +02:00
Thomas Hindoe Paaboel Andersen
8271bd16ce
bootchart: add assert
...
since 376cd3b89c LIST_FIND_TAIL accepts
an empty list. That removed an assert in LIST_FIND_TAIL and we now
theoretically risk a null pointer deref. This adds the assert directly
to protect against that.
2014-06-19 00:18:05 +02:00
Thomas Hindoe Paaboel Andersen
df9db010de
TODO: update
2014-06-18 23:21:00 +02:00
Thomas Hindoe Paaboel Andersen
cee288adf8
socket: check return from exec_spawn
2014-06-18 23:21:00 +02:00
Thomas Hindoe Paaboel Andersen
f7926298e9
sd-dhcp-client: check return from dhcp_option_append
2014-06-18 23:21:00 +02:00
Thomas Hindoe Paaboel Andersen
02557f973a
sd-dhcp-server: fix a leak
...
We must use free instead of dhcp_lease_free here to avoid freeing
client_id.data.
2014-06-18 23:21:00 +02:00
Thomas Hindoe Paaboel Andersen
de228aabc8
install: remove unused variable
2014-06-17 21:22:01 +02:00
Thomas Hindoe Paaboel Andersen
e94b5a7bc2
journal-remote: fix memleak
2014-06-16 23:51:34 +02:00
Thomas Hindoe Paaboel Andersen
efdc73dae3
networkd: link - check returned value from set_lease_pool
2014-06-13 23:00:52 +02:00
Thomas Hindoe Paaboel Andersen
f268f57f63
cryptsetup: check that password is not null
...
Beef up the assert to protect against passing null to strlen.
Found with scan-build.
2014-06-13 00:30:40 +02:00
Thomas Hindoe Paaboel Andersen
47a3fa0f76
udev: check the return value from udev_enumerate_scan_devices
...
The return value from udev_enumerate_scan_devices was stored but
never used. I assume this was meant to be checked.
2014-06-10 19:06:50 +02:00
Thomas Hindoe Paaboel Andersen
817e224bbc
Remove sysv parser from service.c
...
Parsing sysv files was moved to the sysv-generator in the previous commit.
This patch removes the sysv parsing from serivce.c.
Note that this patch drops the following now unused sysv-specific info
from service dump:
"SysV Init Script has LSB Header: (yes/no)"
"SysVEnabled: (yes/no)"
"SysVRunLevels: (levels)"
2014-06-07 00:59:38 +02:00
Thomas Hindoe Paaboel Andersen
95ed3294c6
Move handling of sysv initscripts to a generator
...
Reuses logic from service.c and the rc-local generator.
Note that this drops reading of chkconfig entirely. It also drops reading
runlevels from the LSB headers. The runlevels were only used to check for
runlevels outside of the normal 1-5 range and then add special dependencies
and settings. Special runlevels were dropped in the past so it seemed to be
unused code.
The generator does not know about non-generated units with a value set with
SysVStartPriority=. These are therefor not taken into account when converting
start priority to before/after.
2014-06-07 00:59:32 +02:00
Thomas Hindoe Paaboel Andersen
e5a1c18d70
fix warnings
...
Prevent use of uninitialized variable and removed a now unused
cleanup function for freeaddrinfo
2014-06-06 23:31:25 +02:00
Thomas Hindoe Paaboel Andersen
93f1a06374
util: ignore_file should not allow files ending with '~'
...
ignore_file currently allows any file ending with '~' while it
seems that the opposite was intended:
a228a22fda
2014-05-31 21:44:34 +02:00
Thomas Hindoe Paaboel Andersen
bf9bead187
udev: avoid use of uninitialized err
...
After 1ea972174b err is no longer
set unless we hit a special case. Initialize it to 0 and remove
a check that will never fail.
2014-05-17 08:41:48 +02:00
Thomas Hindoe Paaboel Andersen
4723e4b2a4
systemctl: more cleanup
...
This is followup on 05cae7f343
I think the intention was to use the newly introduced 'path'
variable in the inner loop instead of p.
2014-05-17 08:41:37 +02:00
Thomas Hindoe Paaboel Andersen
24072d36bc
journal-gatewayd: bugfix for invalid level case
...
introduced in cafc7f9130
2014-04-23 20:32:29 +02:00
Thomas Hindoe Paaboel Andersen
7c83910bb9
use new name DRAW_TREE_VERTICAL
...
Was renamed in 6b01f1d391
2014-04-23 19:22:39 +02:00
Thomas Hindoe Paaboel Andersen
cc544d5fb4
networkd: link - add missing curly brackets
...
introduced in 1e9be60bba
2014-04-22 21:45:17 +02:00
Thomas Hindoe Paaboel Andersen
6e37cd2f4a
silence warnings
2014-04-21 00:03:22 +02:00
Thomas Hindoe Paaboel Andersen
806a37e743
systemctl: add --recursive for list-timers
2014-04-16 23:51:27 +02:00
Thomas Hindoe Paaboel Andersen
0cfc352571
systemctl: add --recursive for list-sockets
2014-04-16 00:38:22 +02:00
Thomas Hindoe Paaboel Andersen
b8ec9ba918
bus-proxy: remove unused variable
2014-04-14 21:02:25 +02:00