diff --git a/indigo_drivers/agent_astrometry/indigo_agent_astrometry.c b/indigo_drivers/agent_astrometry/indigo_agent_astrometry.c index 53aa7a6483..bdff2eeebc 100644 --- a/indigo_drivers/agent_astrometry/indigo_agent_astrometry.c +++ b/indigo_drivers/agent_astrometry/indigo_agent_astrometry.c @@ -220,8 +220,8 @@ static bool execute_command(indigo_device *device, char *command, ...) { close(pipe_stdout[0]); dup2(pipe_stdout[1], STDOUT_FILENO); close(pipe_stdout[1]); - execl("/bin/sh", "sh", "-c", buffer, NULL, environ); - perror("execl"); + execle("/bin/sh", "sh", "-c", buffer, NULL, environ); + perror("execle"); _exit(127); } } diff --git a/indigo_drivers/ccd_fli/indigo_ccd_fli.c b/indigo_drivers/ccd_fli/indigo_ccd_fli.c index bbcfd36026..57fa93ab00 100644 --- a/indigo_drivers/ccd_fli/indigo_ccd_fli.c +++ b/indigo_drivers/ccd_fli/indigo_ccd_fli.c @@ -298,7 +298,7 @@ static bool fli_read_pixels(indigo_device *device) { if (timeleft) { indigo_usleep((useconds_t)timeleft); } - } while (timeleft*1000); + } while ((timeleft*1000) != 0); do { pthread_mutex_lock(&PRIVATE_DATA->usb_mutex); diff --git a/indigo_drivers/ccd_pentax/indigo_ccd_pentax.c b/indigo_drivers/ccd_pentax/indigo_ccd_pentax.c index 9a00919f51..b4bc0e23e4 100644 --- a/indigo_drivers/ccd_pentax/indigo_ccd_pentax.c +++ b/indigo_drivers/ccd_pentax/indigo_ccd_pentax.c @@ -396,7 +396,7 @@ static const char *to_hex(uint8_t *bytes, uint32_t count) { } static uint8_t scsi_command(indigo_device *device, uint8_t *cdb, int cdb_len, uint8_t flags, uint8_t *data, uint32_t data_length) { - command_block_wrapper cbw = { { 'U', 'S', 'B', 'C' }, PRIVATE_DATA->tag++, data_length, flags, PRIVATE_DATA->lun, cdb_len, 0 }; + command_block_wrapper cbw = { { 'U', 'S', 'B', 'C' }, PRIVATE_DATA->tag++, data_length, flags, PRIVATE_DATA->lun, cdb_len, {0} }; command_status_wrapper csw; int size = 0; memcpy(cbw.CBWCB, cdb, cdb_len); diff --git a/indigo_drivers/mount_ioptron/indigo_mount_ioptron.c b/indigo_drivers/mount_ioptron/indigo_mount_ioptron.c index 0f4727d39f..846fa03950 100644 --- a/indigo_drivers/mount_ioptron/indigo_mount_ioptron.c +++ b/indigo_drivers/mount_ioptron/indigo_mount_ioptron.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -386,7 +387,7 @@ static bool ieq_set_utc(indigo_device *device, time_t *secs, int utc_offset) { } } } else if (PRIVATE_DATA->protocol == 0x0300) { - sprintf(command, ":SUT%013llu#", (uint64_t)((JDNOW - JD2000) * 8.64e+7)); + sprintf(command, ":SUT%013" PRIu64 "#", (uint64_t)((JDNOW - JD2000) * 8.64e+7)); if (!ieq_command(device, command, response, 1) || *response != '1') { MOUNT_SET_HOST_TIME_PROPERTY->state = INDIGO_ALERT_STATE; } else { diff --git a/indigo_libs/indigo/indigo_client.h b/indigo_libs/indigo/indigo_client.h index 5d8d03ada8..7830d7fddb 100644 --- a/indigo_libs/indigo/indigo_client.h +++ b/indigo_libs/indigo/indigo_client.h @@ -66,6 +66,8 @@ typedef struct { bool initialized; ///< driver is initialized } indigo_driver_entry; +#define INDIGO_LAST_ERROR_SIZE 256 + /** Remote executable entry type. */ typedef struct { @@ -74,7 +76,7 @@ typedef struct { bool thread_started; ///< client thread started/stopped int pid; ///< process pid indigo_device *protocol_adapter; ///< server protocol adapter - char last_error[256]; ///< last error reported within client thread + char last_error[INDIGO_LAST_ERROR_SIZE]; ///< last error reported within client thread } indigo_subprocess_entry; /** Array of all available drivers (statically & dynamically linked). @@ -123,7 +125,7 @@ typedef struct { bool thread_started; ///< client thread started/stopped int socket; ///< stream socket indigo_device *protocol_adapter; ///< server protocol adapter - char last_error[256]; ///< last error reported within client thread + char last_error[INDIGO_LAST_ERROR_SIZE]; ///< last error reported within client thread bool shutdown; ///< request shutdown } indigo_server_entry; @@ -142,7 +144,7 @@ extern indigo_result indigo_connect_server(const char *name, const char *host, i extern indigo_result indigo_connect_server_id(const char *name, const char *host, int port, uint32_t connection_id, indigo_server_entry **server); /** If connected to the server returns true else returns false and last_error (if not NULL) will contain the last error - reported within client thread. Last_error should have length of 256. + reported within client thread. Last_error should have length of INDIGO_LAST_ERROR_SIZE. */ extern bool indigo_connection_status(indigo_server_entry *server, char *last_error); diff --git a/indigo_libs/indigo_client.c b/indigo_libs/indigo_client.c index c4f2132dbe..8fc293d0e4 100644 --- a/indigo_libs/indigo_client.c +++ b/indigo_libs/indigo_client.c @@ -359,10 +359,10 @@ static void *server_thread(indigo_server_entry *server) { hints.ai_family = AF_INET; if ((result = getaddrinfo(server->host, NULL, &hints, &address))) { INDIGO_LOG(indigo_log("Can't resolve host name %s (%s)", server->host, gai_strerror(result))); - strncpy(server->last_error, gai_strerror(result), sizeof(server->last_error)); + strncpy(server->last_error, gai_strerror(result), INDIGO_LAST_ERROR_SIZE); } else if ((server->socket = socket(address->ai_family, SOCK_STREAM, 0)) < 0) { INDIGO_LOG(indigo_log("Can't create socket (%s)", strerror(errno))); - strncpy(server->last_error, strerror(errno), sizeof(server->last_error)); + strncpy(server->last_error, strerror(errno), INDIGO_LAST_ERROR_SIZE); } else { ((struct sockaddr_in *)address->ai_addr)->sin_port = htons(server->port); result = connect(server->socket, address->ai_addr, address->ai_addrlen);