diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index 27aa5f76906f5dec9f17311c39673c6783f432d6..87f43780280f32adedac826db14b897b4611e907 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -1198,7 +1198,8 @@ get_syncterm_filename(char *fn, int fnlen, int type, bool shared) if (!shared) { if (((home == NULL) || (strlen(home) > MAX_PATH - 32))) { /* $HOME just too damn big */ if ((type == SYNCTERM_DEFAULT_TRANSFER_PATH) || (type == SYNCTERM_PATH_CACHE)) { - getcwd(fn, fnlen); + if(getcwd(fn, fnlen) == NULL) + return NULL; backslash(fn); if (type == SYNCTERM_PATH_CACHE) { strcat(fn, "cache"); @@ -1539,8 +1540,7 @@ main(int argc, char **argv) "\tcols#132,lines#60,use=syncterm-bitmap,\n"; if ((argc == 2) && (strcmp(argv[1], "-T") == 0)) { - write(STDOUT_FILENO, syncterm_termcap, strlen(syncterm_termcap)); - return 0; + return write(STDOUT_FILENO, syncterm_termcap, strlen(syncterm_termcap)) > 0 ? EXIT_SUCCESS : EXIT_FAILURE; } if ((argc == 2) && (strcmp(argv[1], "-v") == 0)) { fprintf(stdout, "%s\n", syncterm_version); diff --git a/src/syncterm/term.c b/src/syncterm/term.c index 529fcf09a1b343f17a0a77f18465fcae116bb11f..222c59a3328b3ad21ec00f8057d75bd5d1fe81eb 100644 --- a/src/syncterm/term.c +++ b/src/syncterm/term.c @@ -62,24 +62,24 @@ static struct ciolib_pixels *pixmap_buffer[2]; static struct ciolib_mask *mask_buffer; static uint8_t pnm_gamma[256] = { 0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69, - 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, - 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, - 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, - 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, - 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, - 175, 176, 177, 178, 178, 179, 180, 180, 181, 182, 182, 183, 184, - 185, 185, 186, 187, 187, 188, 189, 189, 190, 190, 191, 192, 192, - 193, 194, 194, 195, 196, 196, 197, 197, 198, 199, 199, 200, 200, - 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 207, 208, 208, - 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, - 216, 216, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, - 223, 223, 224, 224, 225, 226, 226, 227, 227, 228, 228, 229, 229, - 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, - 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, - 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, - 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, + 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, + 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, + 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 148, 149, 150, 151, 152, 153, 154, 155, + 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, + 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, + 175, 176, 177, 178, 178, 179, 180, 180, 181, 182, 182, 183, 184, + 185, 185, 186, 187, 187, 188, 189, 189, 190, 190, 191, 192, 192, + 193, 194, 194, 195, 196, 196, 197, 197, 198, 199, 199, 200, 200, + 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 207, 208, 208, + 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, + 216, 216, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, + 223, 223, 224, 224, 225, 226, 226, 227, 227, 228, 228, 229, 229, + 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, + 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, + 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, + 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255 }; uint8_t pnm_gamma_max = 255; @@ -2034,7 +2034,8 @@ xmodem_download(struct bbslist *bbs, long mode, char *path) if (file_bytes < (ulong)filelength(fileno(fp))) { lprintf(LOG_INFO, "Truncating file to %lu bytes", (ulong)file_bytes); - chsize(fileno(fp), (ulong)file_bytes); /* 4GB limit! */ + if(chsize(fileno(fp), (ulong)file_bytes) != 0) /* 4GB limit! */ + lprintf(LOG_ERR, "Error %d (%s) truncating file", errno, strerror(errno)); } else { file_bytes = filelength(fileno(fp)); @@ -2449,11 +2450,11 @@ buildBt709ToSrgbGamma(const uint8_t maxval) { */ uint8_t const linearCutoff709 = (uint8_t) (maxval * 0.018 + 0.5); - double const linearCompression709 = + double const linearCompression709 = 0.018 / (1.099 * pow(0.018, oneOverGamma709) - 0.099); double const linearCutoffSrgb = 0.0031308; - double const linearExpansionSrgb = + double const linearExpansionSrgb = (1.055 * pow(0.0031308, oneOverGammaSrgb) - 0.055) / 0.0031308; int i;