Fixed: [Error message from CLI if terminal is modified](https://github.com/clicon/clixon-controller/issues/122)

This commit is contained in:
Olof hagsand 2024-05-22 16:47:39 +02:00
parent d5d23dd90e
commit 1904805103
2 changed files with 18 additions and 10 deletions

View file

@ -62,6 +62,7 @@ Developers may need to change their code
### Corrected Bugs ### Corrected Bugs
* Fixed: [Error message from CLI if terminal is modified](https://github.com/clicon/clixon-controller/issues/122)
* Fixed: backend exit when receiving invalid NETCONF get select XPath * Fixed: backend exit when receiving invalid NETCONF get select XPath
* Added XML encoding to XPaths in `select` attribute * Added XML encoding to XPaths in `select` attribute
* Fixed: Fail on return errors when reading from datastore * Fixed: Fail on return errors when reading from datastore

View file

@ -142,8 +142,8 @@ clixon_inet2sin(const char *addrtype,
* Notaly this may an issue of RFC 3896 encoded strings * Notaly this may an issue of RFC 3896 encoded strings
*/ */
struct clicon_msg * struct clicon_msg *
clicon_msg_encode(uint32_t id, clicon_msg_encode(uint32_t id,
const char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
uint32_t xmllen; uint32_t xmllen;
@ -302,10 +302,13 @@ clicon_rpc_connect_inet(clixon_handle h,
/*! Ensure all of data on socket comes through. fn is either read or write /*! Ensure all of data on socket comes through. fn is either read or write
* *
* Just called for read(2)
* @param[in] fn I/O function, ie read/write * @param[in] fn I/O function, ie read/write
* @param[in] fd File descriptor, eg socket * @param[in] fd File descriptor, eg socket
* @param[in] s0 Buffer to read to or write from * @param[in] s0 Buffer to read to or write from
* @param[in] n Number of bytes to read/write, loop until done * @retval n Bytes written (see man 2 read)
* @retval 0 EOF
* @retval -1 Error
*/ */
static ssize_t static ssize_t
atomicio(ssize_t (*fn) (int, void *, size_t), atomicio(ssize_t (*fn) (int, void *, size_t),
@ -313,8 +316,9 @@ atomicio(ssize_t (*fn) (int, void *, size_t),
void *s0, void *s0,
size_t n) size_t n)
{ {
char *s = s0; char *s = s0;
ssize_t res, pos = 0; ssize_t res;
ssize_t pos = 0;
while (n > pos) { while (n > pos) {
_atomicio_sig = 0; _atomicio_sig = 0;
@ -471,7 +475,7 @@ clixon_rpc10(int sock,
cbuf *msgret, cbuf *msgret,
int *eof) int *eof)
{ {
int retval = -1; int retval = -1;
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, ""); clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "");
if (netconf_framing_preamble(NETCONF_SSH_EOM, msg) < 0) if (netconf_framing_preamble(NETCONF_SSH_EOM, msg) < 0)
@ -562,9 +566,12 @@ clixon_msg_rcv11(int s,
if (intr){ if (intr){
if (clixon_signal_save(&oldsigset, oldsigaction) < 0) if (clixon_signal_save(&oldsigset, oldsigaction) < 0)
goto done; goto done;
set_signal(SIGINT, SIG_IGN, NULL); set_signal(SIGINT, SIG_IGN, NULL);
clicon_signal_unblock(SIGINT); clicon_signal_unblock(SIGINT);
set_signal_flags(SIGINT, 0, atomicio_sig_handler, NULL); set_signal_flags(SIGINT, 0, atomicio_sig_handler, NULL);
/* May be more signals to ignore */
set_signal(SIGWINCH, SIG_IGN, NULL);
} }
while (*eof == 0 && eom == 0) { while (*eof == 0 && eom == 0) {
/* Read input data from socket and append to cbbuf */ /* Read input data from socket and append to cbbuf */
@ -722,8 +729,8 @@ send_msg_notify(int s,
const char *descr, const char *descr,
char *msg) char *msg)
{ {
int retval = -1; int retval = -1;
cbuf *cb = NULL; cbuf *cb = NULL;
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new"); clixon_err(OE_UNIX, errno, "cbuf_new");
@ -755,8 +762,8 @@ send_msg_notify_xml(clixon_handle h,
const char *descr, const char *descr,
cxobj *xev) cxobj *xev)
{ {
int retval = -1; int retval = -1;
cbuf *cb = NULL; cbuf *cb = NULL;
if ((cb = cbuf_new()) == NULL){ if ((cb = cbuf_new()) == NULL){
clixon_err(OE_PLUGIN, errno, "cbuf_new"); clixon_err(OE_PLUGIN, errno, "cbuf_new");