Fix issue #8 - Code would return error when file was CORRECTLY opened and report success when it failed.

This commit is contained in:
akuker 2020-07-09 20:20:18 -05:00
parent 96704a002a
commit 7a697309e2

View File

@ -154,7 +154,7 @@ BOOL Init()
// GPIOBUS creation // GPIOBUS creation
bus = new GPIOBUS(); bus = new GPIOBUS();
// GPIO Initialization // GPIO Initialization
if (!bus->Init()) { if (!bus->Init()) {
return FALSE; return FALSE;
@ -207,7 +207,7 @@ void Cleanup()
// Cleanup the Bus // Cleanup the Bus
bus->Cleanup(); bus->Cleanup();
// Discard the GPIOBUS object // Discard the GPIOBUS object
delete bus; delete bus;
@ -307,7 +307,7 @@ void ListDevice(FILE *fp)
FPRT(fp, "No device is installed.\n"); FPRT(fp, "No device is installed.\n");
return; return;
} }
FPRT(fp, "+----+----+------+-------------------------------------\n"); FPRT(fp, "+----+----+------+-------------------------------------\n");
} }
@ -581,7 +581,7 @@ BOOL ProcessCmd(FILE *fp, int id, int un, int cmd, int type, char *file)
filepath.SetPath(file); filepath.SetPath(file);
// Open the file // Open the file
if (pUnit->Open(filepath)) { if (!pUnit->Open(filepath)) {
FPRT(fp, "Error : File open error [%s]\n", file); FPRT(fp, "Error : File open error [%s]\n", file);
return FALSE; return FALSE;
} }
@ -863,7 +863,7 @@ static void *MonThread(void *param)
{ {
struct sched_param schedparam; struct sched_param schedparam;
struct sockaddr_in client; struct sockaddr_in client;
socklen_t len; socklen_t len;
int fd; int fd;
FILE *fp; FILE *fp;
char buf[BUFSIZ]; char buf[BUFSIZ];
@ -893,8 +893,8 @@ static void *MonThread(void *param)
while (1) { while (1) {
// Wait for connection // Wait for connection
memset(&client, 0, sizeof(client)); memset(&client, 0, sizeof(client));
len = sizeof(client); len = sizeof(client);
fd = accept(monsocket, (struct sockaddr*)&client, &len); fd = accept(monsocket, (struct sockaddr*)&client, &len);
if (fd < 0) { if (fd < 0) {
break; break;