removed unnecessary strerror() in clixon_err() calls; added 'function' keyword in all function declarations in the test scripts

This commit is contained in:
Olof hagsand 2021-02-04 12:04:48 +01:00
parent 73414e2ece
commit 1f0147f996
42 changed files with 95 additions and 84 deletions

View file

@ -240,8 +240,8 @@ clixon_client_connect(clicon_handle h,
if ((netconf_bin = getenv("CLIXON_NETCONF_BIN")) == NULL)
netconf_bin = CLIXON_NETCONF_BIN;
if (stat(netconf_bin, &st) < 0){
clicon_err(OE_NETCONF, 0, "netconf binary %s: %s. Set with CLIXON_NETCONF_BIN=",
netconf_bin, strerror(errno));
clicon_err(OE_NETCONF, errno, "netconf binary %s. Set with CLIXON_NETCONF_BIN=",
netconf_bin);
goto err;
}
argv[i++] = netconf_bin;

View file

@ -137,7 +137,7 @@ clicon_file_dirent(const char *dir,
snprintf(filename, MAXPATHLEN-1, "%s/%s", dir, dent->d_name);
res = lstat(filename, &st);
if (res != 0) {
clicon_err(OE_UNIX, 0, "lstat: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "lstat");
goto quit;
}
if ((type & st.st_mode) == 0)

View file

@ -122,7 +122,7 @@ clicon_hash_init(void)
clicon_hash_t *hash;
if ((hash = (clicon_hash_t *)malloc(sizeof(clicon_hash_t) * HASH_SIZE)) == NULL){
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "malloc");
return NULL;
}
memset(hash, 0, sizeof(clicon_hash_t)*HASH_SIZE);
@ -240,14 +240,14 @@ clicon_hash_add(clicon_hash_t *hash,
h = clicon_hash_lookup(hash, key);
if (h == NULL) {
if ((new = (clicon_hash_t)malloc(sizeof(*new))) == NULL){
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "malloc");
goto catch;
}
memset(new, 0, sizeof(*new));
new->h_key = strdup(key);
if (new->h_key == NULL){
clicon_err(OE_UNIX, errno, "strdup: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "strdup");
goto catch;
}
@ -258,7 +258,7 @@ clicon_hash_add(clicon_hash_t *hash,
/* Make copy of value. aligned */
newval = malloc(align4(vlen+3));
if (newval == NULL){
clicon_err(OE_UNIX, errno, "malloc: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "malloc");
goto catch;
}
memcpy(newval, val, vlen);
@ -349,7 +349,7 @@ clicon_hash_keys(clicon_hash_t *hash,
break;
tmp = realloc(keys, ((*nkeys)+1) * sizeof(char *));
if (tmp == NULL){
clicon_err(OE_UNIX, errno, "realloc: %s", strerror(errno));
clicon_err(OE_UNIX, errno, "realloc");
goto catch;
}
keys = tmp;

View file

@ -208,7 +208,7 @@ fork_netns_socket(const char *netns,
return -1;
}
if (setns(fd, CLONE_NEWNET) < 0){
clicon_err(OE_UNIX, errno, "setns(%s)%d", netns, errno);
clicon_err(OE_UNIX, errno, "setns(%s)", netns);
return -1;
}
close(fd);

View file

@ -702,7 +702,7 @@ rpc_callback_register(clicon_handle h,
goto done;
}
if ((rc = malloc(sizeof(rpc_callback_t))) == NULL) {
clicon_err(OE_DB, errno, "malloc: %s", strerror(errno));
clicon_err(OE_DB, errno, "malloc");
goto done;
}
memset(rc, 0, sizeof(*rc));
@ -829,7 +829,7 @@ upgrade_callback_reg_fn(clicon_handle h,
upgrade_callback_t *uc;
if ((uc = malloc(sizeof(upgrade_callback_t))) == NULL) {
clicon_err(OE_DB, errno, "malloc: %s", strerror(errno));
clicon_err(OE_DB, errno, "malloc");
goto done;
}
memset(uc, 0, sizeof(*uc));

View file

@ -203,7 +203,6 @@ clixon_proc_socket_close(pid_t pid,
* @param[out] pid
* @retval 0 OK
* @retval -1 Error.
* @note SIGCHLD is set to IGN here. Maybe it should be done in main?
*/
int
clixon_proc_background(char **argv,
@ -280,9 +279,6 @@ clixon_proc_background(char **argv,
done:
sigprocmask(SIG_SETMASK, &oset, NULL);
set_signal(SIGINT, oldhandler, NULL);
/* Ensure reap proc child in same session */
if (set_signal(SIGCHLD, SIG_IGN, NULL) < 0)
goto quit;
*pid0 = child;
retval = 0;
quit: