summaryrefslogtreecommitdiff
path: root/src/journal-remote
Commit message (Collapse)AuthorAge
* wrap a few *_FOREACH macros in curly bracesThomas Hindoe Paaboel Andersen2014-12-12
| | | | | | cppcheck would give up with "syntax error" without them. This led to reports of syntax errors in unrelated locations and potentially hid other errors
* journald-remote,journal-upload: Support .d directories in the usual search pathsJosh Triplett2014-11-29
|
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: more log_*_errno + return simplificationsMichal Schmidt2014-11-28
|
* treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal Schmidt2014-11-28
|
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-28
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* log: rearrange log function namingLennart Poettering2014-11-27
| | | | | | | | | | - Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-27
| | | | | | | | | | | | | | | | | | | | log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
* strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering2014-11-10
| | | | This should make the unquoting scheme a bit less naive.
* sd-event: implicitly set signal event source's descriptions to the signal nameLennart Poettering2014-11-04
|
* sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()Lennart Poettering2014-11-04
| | | | | To mirror the recent name change of the concept for sd_bus objects, follow the same logic for sd_event_source objects, too.
* journal-upload: return proper exit codeZbigniew Jędrzejewski-Szmek2014-10-23
| | | | | Even when termninated normally, systemd-journal-upload would return something positive which would be interpreted as failure.
* shared/log: add log_trace as compile-time optional debuggingZbigniew Jędrzejewski-Szmek2014-10-23
| | | | | | | | | Repetetive messages can be annoying when running with SYSTEMD_LOG_LEVEL=debug, but they are sometimes very useful when debugging problems. Add log_trace which is like log_debug but becomes a noop unless LOG_TRACE is defined during compilation. This makes it easy to enable very verbose logging for a subset of programs when compiling from source.
* journal-upload: fix --trust=all optionZbigniew Jędrzejewski-Szmek2014-10-23
|
* journal-upload: avoid calling printf with maximum precisionZbigniew Jędrzejewski-Szmek2014-10-23
| | | | | | Precision of INT_MAX does not work as I expected it to. https://bugzilla.redhat.com/show_bug.cgi?id=1154334
* journal-upload: verify state file can be saved before uploadingZbigniew Jędrzejewski-Szmek2014-10-23
| | | | | Do our best verify that we can actually write the state file before upload commences to avoid duplicate messages on the server.
* journal-remote: add --split-mode to helpZbigniew Jędrzejewski-Szmek2014-10-23
|
* journal-remote: better error message on failureZbigniew Jędrzejewski-Szmek2014-10-23
| | | | Return a proper code instead of simply NULL for failure.
* journal-upload: do not require port to be setZbigniew Jędrzejewski-Szmek2014-10-23
|
* systemd-upload: print paths in help()Zbigniew Jędrzejewski-Szmek2014-10-23
|
* journal-remote: give names to event sourcesZbigniew Jędrzejewski-Szmek2014-10-23
| | | | This possibility was recently added, and it makes debugging much nicer.
* journal-upload: fix socket activationZbigniew Jędrzejewski-Szmek2014-10-23
|
* journal-remote: fix mem leak on errorZbigniew Jędrzejewski-Szmek2014-10-14
|
* journal-remote: fix handling of non-blocking sourcesZbigniew Jędrzejewski-Szmek2014-09-29
| | | | | | | In the conversion to sd-event loop, handling of normal files got broken. We do not want to perform non-blocking reads on them, but simply do read() in a loop. Install a statically-enabled "source" to do that.
* journal-remote: fix counting of events writtenZbigniew Jędrzejewski-Szmek2014-09-25
| | | | | | | | | | | After recent changes the number was always reported as 0, because the accounting was done server_destroy(), called after the message was already printed. But even before this change, the counts were wrong because seqnum start at 0 only for newly created journal files, so when appending to existing files, the calculated count was wrong anyway. Also do some variable renaming for consistency and disable some low-level debug messages.
* journal-remote: initialize writer hashmap before useJonathan Liu2014-09-25
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=83682 [zj: move the initalization even earlier, before any sockets are looked at.]
* journal-remote: check return code of sd_event_defaultAndreas Henriksson2014-09-18
| | | | | | | Handle sd_event_default returning error and bail out properly as done in every other caller of this function. Found by coverity. Fixes: CID#1238957
* journal-upload: Remove compilation warningPhilippe De Swert2014-09-18
| | | | | | | | | When compiling we see this curl warning popping up: src/journal-remote/journal-upload.c:194:17: warning: call to ‘_curl_easy_setopt_err_error_buffer’ declared with attribute warning: curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option [enabled by default] This patch removes the warning (which occurs twice).
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* journal-remote: fix check if realloc failedThomas Hindoe Paaboel Andersen2014-08-31
|
* notify: send STOPPING=1 from our daemonsLennart Poettering2014-08-21
|
* journal-upload: make sure that 'r' is initializedLukas Nykryn2014-08-20
|
* journal-remote: remove unreachable codeLukas Nykryn2014-08-20
|
* journal-upload: allow the tool to startLennart Poettering2014-08-20
|
* cmdline: for new tools avoid introduce new negative switches, and properly ↵Lennart Poettering2014-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | align --help texts Negative switches are a bad un-normalized thing. We alerady have some, but we should try harder to avoid intrdoucing new ones. Hence, instead of adding two switches: --foobar --no-foobar Let's instead use the syntax --foobar --foobar=yes --foobar=no Where the first two are equivalent. The boolean argument is parsed following the usual rules. Change all new negative switches this way. This patch also properly aligns the --help table, so that single char switches always get a column separate of the long switches.
* journal-remote: fix parsing of fd command line argumentLennart Poettering2014-08-11
|
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-03
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* journal-remote: rename KEY_FILE to avoid confict with <linux/input.h>Zbigniew Jędrzejewski-Szmek2014-08-03
|
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek2014-07-16
| | | | | | | | Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
* journal-remote: remove obsolete variableZbigniew Jędrzejewski-Szmek2014-07-16
|
* journal-remote: fix double typedef and add missing headerZbigniew Jędrzejewski-Szmek2014-07-16
|
* journal-remote: avoid copying input dataZbigniew Jędrzejewski-Szmek2014-07-15
| | | | | | Instead of copying fields into new memory allocations, simply keep pointers into the receive buffer. Data in this buffer is only copied when there is not enough space for new data and a large chunk of the buffer contains old data.
* µhttp-util: fix compilation without gnutlsZbigniew Jędrzejewski-Szmek2014-07-15
|
* journal-upload: add config fileZbigniew Jędrzejewski-Szmek2014-07-15
|