mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-28 01:41:48 +03:00
Fix some compiler warnings
Covscan analyzer was used Signed-off-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Jakub Jelen
parent
6daa95f9c1
commit
63f97a3d03
@ -233,7 +233,7 @@ static int open_location(struct location *loc, int flag) {
|
|||||||
loc->file = fopen(loc->path, flag == READ ? "r":"w");
|
loc->file = fopen(loc->path, flag == READ ? "r":"w");
|
||||||
if (!loc->file) {
|
if (!loc->file) {
|
||||||
if (errno == EISDIR) {
|
if (errno == EISDIR) {
|
||||||
if (chdir(loc->path)) {
|
if (loc->path != NULL && chdir(loc->path)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error changing directory to %s: %s\n",
|
"Error changing directory to %s: %s\n",
|
||||||
loc->path, strerror(errno));
|
loc->path, strerror(errno));
|
||||||
|
@ -92,7 +92,11 @@ cleanup_push(struct cleanup_node_struct** head_ref,
|
|||||||
// Allocate memory for node
|
// Allocate memory for node
|
||||||
struct cleanup_node_struct *new_node = malloc(sizeof *new_node);
|
struct cleanup_node_struct *new_node = malloc(sizeof *new_node);
|
||||||
|
|
||||||
new_node->next = (*head_ref);
|
if (head_ref != NULL) {
|
||||||
|
new_node->next = *head_ref;
|
||||||
|
} else {
|
||||||
|
new_node->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy new_data
|
// Copy new_data
|
||||||
new_node->data = new_data;
|
new_node->data = new_data;
|
||||||
@ -518,6 +522,12 @@ message_callback(UNUSED_PARAM(ssh_session session),
|
|||||||
pFd = malloc(sizeof *pFd);
|
pFd = malloc(sizeof *pFd);
|
||||||
cb_chan = malloc(sizeof *cb_chan);
|
cb_chan = malloc(sizeof *cb_chan);
|
||||||
event_fd_data = malloc(sizeof *event_fd_data);
|
event_fd_data = malloc(sizeof *event_fd_data);
|
||||||
|
if (pFd == NULL || cb_chan == NULL || event_fd_data == NULL) {
|
||||||
|
SAFE_FREE(pFd);
|
||||||
|
SAFE_FREE(cb_chan);
|
||||||
|
SAFE_FREE(event_fd_data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
(*pFd) = socket_fd;
|
(*pFd) = socket_fd;
|
||||||
event_fd_data->channel = channel;
|
event_fd_data->channel = channel;
|
||||||
|
@ -255,7 +255,11 @@ int ssh_getpass(const char *prompt,
|
|||||||
|
|
||||||
/* disable nonblocking I/O */
|
/* disable nonblocking I/O */
|
||||||
if (fd & O_NDELAY) {
|
if (fd & O_NDELAY) {
|
||||||
fcntl(0, F_SETFL, fd & ~O_NDELAY);
|
ok = fcntl(0, F_SETFL, fd & ~O_NDELAY);
|
||||||
|
if (ok < 0) {
|
||||||
|
perror("fcntl");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = ssh_gets(prompt, buf, len, verify);
|
ok = ssh_gets(prompt, buf, len, verify);
|
||||||
@ -267,7 +271,11 @@ int ssh_getpass(const char *prompt,
|
|||||||
|
|
||||||
/* close fd */
|
/* close fd */
|
||||||
if (fd & O_NDELAY) {
|
if (fd & O_NDELAY) {
|
||||||
fcntl(0, F_SETFL, fd);
|
ok = fcntl(0, F_SETFL, fd);
|
||||||
|
if (ok < 0) {
|
||||||
|
perror("fcntl");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
Reference in New Issue
Block a user