Fix stratagus-maemo-extract.h - ignore '\n' in version string

This commit is contained in:
Pali Rohár 2012-08-19 11:11:12 +02:00
parent f1f5559d1b
commit e1c8c27bbb

View file

@ -194,24 +194,48 @@ int main(int argc, char * argv[]) {
if ( file ) {
char act_version[20];
fgets(act_version, 20, file);
int have_version = 0;
if ( fgets(act_version, 20, file) )
have_version = 1;
fclose(file);
if ( have_version ) {
file = popen(EXTRACT_BIN " -V", "r");
if ( file ) {
int i;
char new_version[20];
fgets(new_version, 20, file);
have_version = 0;
if ( fgets(new_version, 20, file) )
have_version = 1;
pclose(file);
if ( strncmp(act_version, new_version, 19) == 0 )
if ( have_version ) {
for ( i = 0; i < 20; ++i ) {
if ( new_version[i] == '\n' ) {
new_version[i] = 0;
break;
}
}
if ( strcmp(act_version, new_version) == 0 )
return 0;
}
}
}
}
message(GAME_NAME, DATA_NEED_COPY, 0);
if ( stat(DATA_DIR "/" GAME_CD_FILE, &st) != 0 ) {