removed unnecessary strerror() in clixon_err() calls; added 'function' keyword in all function declarations in the test scripts
This commit is contained in:
parent
73414e2ece
commit
1f0147f996
42 changed files with 95 additions and 84 deletions
|
|
@ -144,7 +144,13 @@ typedef int (plgextension_t)(clicon_handle h, yang_stmt *yext, yang_stmt *ys);
|
|||
*/
|
||||
typedef int (plgauth_t)(clicon_handle, void *);
|
||||
|
||||
typedef int (plgreset_t)(clicon_handle h, const char *db); /* Reset system status */
|
||||
/*! Reset system status
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] db Database name (eg "running")
|
||||
* @retval -1 Fatal error
|
||||
* @retval 0 OK
|
||||
*/
|
||||
typedef int (plgreset_t)(clicon_handle h, const char *db);
|
||||
|
||||
/* Plugin statedata
|
||||
* @param[in] Clicon handle
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue