search for: syserrno

Displaying 5 results from an estimated 5 matches for "syserrno".

2007 Jan 23
2
Re: [nut-commits] svn commit r731
...n local, server; > + struct hostent *serv; > #else > - struct addrinfo hints, *r, *rtmp; > - char *service; > + struct addrinfo hints, *res, *ai; > + char sport[NI_MAXSERV]; > #endif > > /* clear out any lingering junk */ > @@ -437,11 +438,10 @@ > ups->syserrno = 0; > ups->upsclient_magic = UPSCLIENT_MAGIC; > > - ups->pc_ctx = malloc(sizeof(PCONF_CTX)); > - > - if (!ups->pc_ctx) { > + if ((ups->pc_ctx = malloc(sizeof(PCONF_CTX))) == NULL) > + { > ups->upserror = UPSCLI_ERR_NOMEM; > - return -1; > + r...
2007 Jan 06
3
Re: [nut-commits] svn commit r708 - in trunk: . clients server
...SUCHHOST; > + service = malloc (sizeof (char) * 6); > + if (service == NULL) { > + ups->upserror = UPSCLI_ERR_NOMEM; > return -1; > } > > - if ((ups->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { > - ups->upserror = UPSCLI_ERR_SOCKFAILURE; > - ups->syserrno = errno; > + if (snprintf (service, 6, "%hu", (unsigned short int)port) < 1) { > return -1; > } > > - memset(&local, '\0', sizeof(struct sockaddr_in)); > - local.sin_family = AF_INET; > - local.sin_port = htons(INADDR_ANY); > - > - memset(&...
2007 Jan 06
1
Re: [nut-commits] svn commit r710 - in trunk: . clients server
...V6 > + if ((serv = gethostbyname(host)) == (struct hostent *) NULL) { > + > + ups->upserror = UPSCLI_ERR_NOSUCHHOST; > + return -1; > + } > + > + if ((ups->fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { > + ups->upserror = UPSCLI_ERR_SOCKFAILURE; > + ups->syserrno = errno; > + return -1; > + } > + > + memset(&local, '\0', sizeof(struct sockaddr_in)); > + local.sin_family = AF_INET; > + local.sin_port = htons(INADDR_ANY); > + > + memset(&server, '\0', sizeof(struct sockaddr_in)); > + server.sin_family = AF_I...
2007 Jan 19
0
Re: [nut-commits] svn commit r755 - in trunk: . clients
> * are you sure you want to use fprintf(stderr, ...) in a library? > This doesn't seem like a good idea to me. Wouldn't it be more > consistent to extend upscli_errlist[] ? Errorcodes are passed in 'ups->upserror' (and 'ups->syserrno'). Uh oh, we don't have a connection to an UPS yet when we call upscli_splitname() or upscli_splitaddr(). The upscli_strerror() function that is used to return the message in upscli_errlist[] needs a pointer to a UPSCONN structure also. The upscli_errlist[] is static, so there is no way to...
2007 Jan 12
2
Makefiles driving me NUTs
I want to use upsdebugx, upslogx in 'clients/upsclient.c', however this fails with the following error messages (I trimmed the path to the build directory to <path> in order to prevent line wrapping): <path>/clients/upsclient.c:941: undefined reference to `upsdebugx' <path>/clients/upsclient.c:910: undefined reference to `upslogx'