Patched version of patch. Can you please ACK?
Regards, Honza Jan Friesse wrote: > Sorry, > I forgot include patch. > > Jan Friesse wrote: >> This is side effect of gid-uid patch I'm working on. >> >> Patch handles situations, where: >> - File is bad -> no error message is written (because it's replaced >> AFTER parse_section) >> - No newline is in the end of file (yes I know, it's not proper text >> file, but ...) >> - Handle obscure OS, where line doesn't end with \n, but end with \r (I >> think MAC is that case) or \r\n (we know what is that case) >> >> Regards, >> Honza >> >
commit 15fdf5c25c0dc4a7438f70c118e5c114bd1027e8 Author: Jan Friesse <[email protected]> Date: Mon May 18 12:32:54 2009 +0200 Handle coroparse errors and different EOL diff --git a/trunk/exec/coroparse.c b/trunk/exec/coroparse.c index 2728803..5921327 100644 --- a/trunk/exec/coroparse.c +++ b/trunk/exec/coroparse.c @@ -94,8 +94,12 @@ static int parse_section(FILE *fp, char *loc; while (fgets (line, 255, fp)) { - if (strlen(line) > 0) - line[strlen(line) - 1] = '\0'; + if (strlen(line) > 0) { + if (line[strlen(line) - 1] == '\n') + line[strlen(line) - 1] = '\0'; + if (strlen (line) > 0 && line[strlen(line) - 1] == '\r') + line[strlen(line) - 1] = '\0'; + } /* * Clear out white space and tabs */ @@ -181,9 +185,11 @@ static int read_config_file_into_objdb( fclose(fp); - snprintf (error_reason, sizeof(error_string_response), + if (res == 0) { + snprintf (error_reason, sizeof(error_string_response), "Successfully read main configuration file '%s'.\n", filename); - *error_string = error_reason; + *error_string = error_reason; + } return res; }
_______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
