summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2018-08-02 17:29:34 +0000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-08-07 11:30:36 +1000
commitc78f9ec47ba92b74698dacdae963dbbefd9b676f (patch)
tree58ce2f0f50f8edb451f81d9ecedc9abc842bc3d6 /lib
parent679d9dceb5bdf51f118548ca2645dc81088a8974 (diff)
downloadtalos-petitboot-c78f9ec47ba92b74698dacdae963dbbefd9b676f.zip
talos-petitboot-c78f9ec47ba92b74698dacdae963dbbefd9b676f.tar.gz
lib/log: Switch to pb_log_fn
The only functional change should be an additional '/n' to a few log messagees that seemed to be missing it. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/file/file.c6
-rw-r--r--lib/flash/flash.c8
-rw-r--r--lib/pb-protocol/pb-protocol.c8
-rw-r--r--lib/process/process.c12
-rw-r--r--lib/security/common.c2
-rw-r--r--lib/security/gpg.c26
-rw-r--r--lib/security/openssl.c18
-rw-r--r--lib/url/url.c2
8 files changed, 41 insertions, 41 deletions
diff --git a/lib/file/file.c b/lib/file/file.c
index b575d34..6028005 100644
--- a/lib/file/file.c
+++ b/lib/file/file.c
@@ -54,13 +54,13 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
destination_fd = mkstemp(template);
if (destination_fd < 0) {
- pb_log("%s: unable to create temp file, %m\n", __func__);
+ pb_log_fn("unable to create temp file, %m\n");
fclose(source_handle);
return -1;
}
destination_handle = fdopen(destination_fd, "w");
if (!destination_handle) {
- pb_log("%s: unable to open destination file, %m\n", __func__);
+ pb_log_fn("unable to open destination file, %m\n");
fclose(source_handle);
close(destination_fd);
return -1;
@@ -81,7 +81,7 @@ int copy_file_secure_dest(void *ctx, const char *source_file,
if (ferror(destination_handle)) {
/* General error */
result = -1;
- pb_log("%s: failed: unknown fault\n", __func__);
+ pb_log_fn("failed: unknown fault\n");
}
else {
/* No space on destination device */
diff --git a/lib/flash/flash.c b/lib/flash/flash.c
index 464b876..b7e5b88 100644
--- a/lib/flash/flash.c
+++ b/lib/flash/flash.c
@@ -94,7 +94,7 @@ static struct flash_info *flash_setup_buffer(void *ctx, const char *partition)
rc = ffs_init(0, info->size, info->bl, &info->ffs, 1);
if (rc) {
- pb_log("%s: Failed to init ffs\n", __func__);
+ pb_log_fn("Failed to init ffs\n");
goto out_flash;
}
@@ -171,7 +171,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
len = cur_info->attr_data_len - ecc_size(cur_info->attr_data_len);
buffer = talloc_array(cur_info, char, len);
if (!buffer) {
- pb_log("%s: Failed to init buffer!\n", __func__);
+ pb_log_fn("Failed to init buffer!\n");
goto out;
}
@@ -187,7 +187,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
if (tok) {
tmp = talloc_realloc(ctx, tmp, char *, n + 1);
if (!tmp) {
- pb_log("%s: Failed to allocate memory\n", __func__);
+ pb_log_fn("Failed to allocate memory\n");
goto out;
}
tmp[n++] = talloc_strdup(ctx, tok);
@@ -198,7 +198,7 @@ int flash_parse_version(void *ctx, char ***versions, bool current)
/* Ignore leading tab from subsequent lines */
tmp = talloc_realloc(ctx, tmp, char *, n + 1);
if (!tmp) {
- pb_log("%s: Failed to reallocate memory\n", __func__);
+ pb_log_fn("Failed to reallocate memory\n");
n = 0;
goto out;
}
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 41707da..315efc4 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -725,7 +725,7 @@ int pb_protocol_write_message(int fd, struct pb_protocol_message *message)
if (!total_len)
return 0;
- pb_log("%s: failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("failed: %s\n", strerror(errno));
return -1;
}
@@ -735,7 +735,7 @@ struct pb_protocol_message *pb_protocol_create_message(void *ctx,
struct pb_protocol_message *message;
if (payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
- pb_log("%s: payload too big %u/%u\n", __func__, payload_len,
+ pb_log_fn("payload too big %u/%u\n", payload_len,
PB_PROTOCOL_MAX_PAYLOAD_SIZE);
return NULL;
}
@@ -766,7 +766,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
m.action = __be32_to_cpu(m.action);
if (m.payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
- pb_log("%s: payload too big %u/%u\n", __func__, m.payload_len,
+ pb_log_fn("payload too big %u/%u\n", m.payload_len,
PB_PROTOCOL_MAX_PAYLOAD_SIZE);
return NULL;
}
@@ -779,7 +779,7 @@ struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
if (rc <= 0) {
talloc_free(message);
- pb_log("%s: failed (%u): %s\n", __func__, len,
+ pb_log_fn("failed (%u): %s\n", len,
strerror(errno));
return NULL;
}
diff --git a/lib/process/process.c b/lib/process/process.c
index c1606a5..1fa0bb0 100644
--- a/lib/process/process.c
+++ b/lib/process/process.c
@@ -92,7 +92,7 @@ static int process_read_stdout_once(struct process_info *procinfo, char **line)
if (rc < 0) {
if (errno == EINTR)
return 1;
- pb_log("%s: read failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("read failed: %s\n", strerror(errno));
return rc;
}
@@ -232,7 +232,7 @@ static void sigchld_sigaction(int signo, siginfo_t *info,
rc = write(procset->sigchld_pipe[1], &pid, sizeof(pid));
if (rc != sizeof(pid))
- pb_log("%s: write failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("write failed: %s\n", strerror(errno));
}
static int sigchld_pipe_event(void *arg)
@@ -306,7 +306,7 @@ struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
rc = pipe(procset->sigchld_pipe);
if (rc) {
- pb_log("%s: pipe() failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("pipe() failed: %s\n", strerror(errno));
goto err_free;
}
@@ -322,7 +322,7 @@ struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
rc = sigaction(SIGCHLD, &sa, NULL);
if (rc) {
- pb_log("%s: sigaction() failed: %s\n", __func__,
+ pb_log_fn("sigaction() failed: %s\n",
strerror(errno));
goto err_remove;
}
@@ -374,7 +374,7 @@ static int process_run_common(struct process_info *procinfo)
pid = fork();
if (pid < 0) {
- pb_log("%s: fork failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("fork failed: %s\n", strerror(errno));
return pid;
}
@@ -410,7 +410,7 @@ int process_run_sync(struct process *process)
if (errno == EINTR)
continue;
- pb_log("%s: waitpid failed: %s\n", __func__, strerror(errno));
+ pb_log_fn("waitpid failed: %s\n", strerror(errno));
return rc;
}
diff --git a/lib/security/common.c b/lib/security/common.c
index df04054..a93ee98 100644
--- a/lib/security/common.c
+++ b/lib/security/common.c
@@ -81,7 +81,7 @@ int validate_boot_files(struct boot_task *boot_task) {
/* Load authorized signatures file */
authorized_signatures_handle = fopen(LOCKDOWN_FILE, "r");
if (!authorized_signatures_handle) {
- pb_log("%s: unable to read lockdown file\n", __func__);
+ pb_log_fn("unable to read lockdown file\n");
return KEXEC_LOAD_SIG_SETUP_INVALID;
}
diff --git a/lib/security/gpg.c b/lib/security/gpg.c
index aae85aa..e319a06 100644
--- a/lib/security/gpg.c
+++ b/lib/security/gpg.c
@@ -73,22 +73,22 @@ int decrypt_file(const char *filename,
gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: OpenPGP support not available\n", __func__);
+ pb_log_fn("OpenPGP support not available\n");
return -1;
}
err = gpgme_get_engine_info(&enginfo);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG engine failed to initialize\n", __func__);
+ pb_log_fn("GPG engine failed to initialize\n");
return -1;
}
err = gpgme_new(&gpg_context);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG context could not be created\n", __func__);
+ pb_log_fn("GPG context could not be created\n");
return -1;
}
err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG protocol could not be set\n", __func__);
+ pb_log_fn("GPG protocol could not be set\n");
return -1;
}
if (keyring_path)
@@ -100,7 +100,7 @@ int decrypt_file(const char *filename,
GPGME_PROTOCOL_OpenPGP,
enginfo->file_name, enginfo->home_dir);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: Could not set GPG engine information\n", __func__);
+ pb_log_fn("Could not set GPG engine information\n");
return -1;
}
err = gpgme_data_new(&plaintext_data);
@@ -120,7 +120,7 @@ int decrypt_file(const char *filename,
err = gpgme_op_decrypt_verify(gpg_context, ciphertext_data,
plaintext_data);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: Could not decrypt file\n", __func__);
+ pb_log_fn("Could not decrypt file\n");
return -1;
}
verification_result = gpgme_op_verify_result(gpg_context);
@@ -210,7 +210,7 @@ int decrypt_file(const char *filename,
gpgme_release(gpg_context);
if (!valid) {
- pb_log("%s: Incorrect GPG signature\n", __func__);
+ pb_log_fn("Incorrect GPG signature\n");
return -1;
}
@@ -242,22 +242,22 @@ int verify_file_signature(const char *plaintext_filename,
gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: OpenPGP support not available\n", __func__);
+ pb_log_fn("OpenPGP support not available\n");
return -1;
}
err = gpgme_get_engine_info(&enginfo);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG engine failed to initialize\n", __func__);
+ pb_log_fn("GPG engine failed to initialize\n");
return -1;
}
err = gpgme_new(&gpg_context);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG context could not be created\n", __func__);
+ pb_log_fn("GPG context could not be created\n");
return -1;
}
err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: GPG protocol could not be set\n", __func__);
+ pb_log_fn("GPG protocol could not be set\n");
return -1;
}
if (keyring_path)
@@ -269,7 +269,7 @@ int verify_file_signature(const char *plaintext_filename,
GPGME_PROTOCOL_OpenPGP, enginfo->file_name,
enginfo->home_dir);
if (err != GPG_ERR_NO_ERROR) {
- pb_log("%s: Could not set GPG engine information\n", __func__);
+ pb_log_fn("Could not set GPG engine information\n");
return -1;
}
err = gpgme_data_new_from_file(&plaintext_data, plaintext_filename, 1);
@@ -340,7 +340,7 @@ int verify_file_signature(const char *plaintext_filename,
gpgme_release(gpg_context);
if (!valid) {
- pb_log("%s: Incorrect GPG signature\n", __func__);
+ pb_log_fn("Incorrect GPG signature\n");
return -1;
}
diff --git a/lib/security/openssl.c b/lib/security/openssl.c
index 6454f8a..d9dfb95 100644
--- a/lib/security/openssl.c
+++ b/lib/security/openssl.c
@@ -94,7 +94,7 @@ static int get_pkcs12(FILE *keyfile, X509 **cert, EVP_PKEY **priv)
*/
if (!PKCS12_parse(p12, NULL, priv, cert, NULL) &&
!PKCS12_parse(p12, "", priv, cert, NULL)) {
- pb_log("%s: Error parsing OpenSSL PKCS12:\n", __func__);
+ pb_log_fn("Error parsing OpenSSL PKCS12:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
} else
ok = 1;
@@ -131,7 +131,7 @@ static STACK_OF(X509) *get_cert_stack(FILE *keyfile)
if (cert)
sk_X509_push(certs, get_cert(keyfile));
} else {
- pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+ pb_log_fn("Error allocating OpenSSL X509 stack:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
}
@@ -168,7 +168,7 @@ static EVP_PKEY *get_public_key(FILE *keyfile)
/* handles both cases */
if (!pkey) {
- pb_log("%s: Error loading OpenSSL public key:\n", __func__);
+ pb_log_fn("Error loading OpenSSL public key:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
}
@@ -240,7 +240,7 @@ int decrypt_file(const char *filename,
certs = sk_X509_new_null();
if (!certs) {
- pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+ pb_log_fn("Error allocating OpenSSL X509 stack:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
goto out;
}
@@ -268,7 +268,7 @@ int decrypt_file(const char *filename,
/* in this mode its attached content */
if (!CMS_verify(cms, certs, NULL, content_bio, out_bio,
CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
- pb_log("%s: Failed OpenSSL CMS decrypt verify:\n", __func__);
+ pb_log_fn("Failed OpenSSL CMS decrypt verify:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
goto out;
}
@@ -359,7 +359,7 @@ int verify_file_signature(const char *plaintext_filename,
if (!CMS_verify(cms, certs, NULL, plaintext_bio, NULL,
CMS_DETACHED | CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
- pb_log("%s: Failed OpenSSL CMS verify:\n", __func__);
+ pb_log_fn("Failed OpenSSL CMS verify:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
goto out;
}
@@ -375,7 +375,7 @@ int verify_file_signature(const char *plaintext_filename,
ctx = EVP_MD_CTX_create();
if (!ctx) {
- pb_log("%s: Error allocating OpenSSL MD ctx:\n", __func__);
+ pb_log_fn("Error allocating OpenSSL MD ctx:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
goto out;
}
@@ -385,7 +385,7 @@ int verify_file_signature(const char *plaintext_filename,
goto out;
if (EVP_DigestVerifyInit(ctx, NULL, s_verify_md, NULL, pkey) < 1) {
- pb_log("%s: Error initializing OpenSSL verify:\n", __func__);
+ pb_log_fn("Error initializing OpenSSL verify:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
goto out;
}
@@ -425,7 +425,7 @@ int verify_file_signature(const char *plaintext_filename,
if (EVP_DigestVerifyFinal(ctx, (unsigned char*)sigbuf, siglen))
nok = 0;
else {
- pb_log("%s: Error finalizing OpenSSL verify:\n", __func__);
+ pb_log_fn("Error finalizing OpenSSL verify:\n");
ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
}
}
diff --git a/lib/url/url.c b/lib/url/url.c
index f0e8b0e..44e9ac4 100644
--- a/lib/url/url.c
+++ b/lib/url/url.c
@@ -193,7 +193,7 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
path = strchr(p, '/');
if (!path) {
- pb_log("%s: parse path failed '%s'\n", __func__ , p);
+ pb_log_fn("parse path failed '%s'\n" , p);
goto fail;
}
OpenPOWER on IntegriCloud