|
15 | 15 | * |
16 | 16 | * |
17 | 17 | * IDENTIFICATION |
18 | | - *$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.108 2005/04/30 08:08:51 neilc Exp $ |
| 18 | + *$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.109 2005/05/17 17:30:29 tgl Exp $ |
19 | 19 | * |
20 | 20 | *------------------------------------------------------------------------- |
21 | 21 | */ |
@@ -891,24 +891,21 @@ SortTocFromFile(Archive *AHX, RestoreOptions *ropt) |
891 | 891 | if (!fh) |
892 | 892 | die_horribly(AH,modulename,"could not open TOC file\n"); |
893 | 893 |
|
894 | | -while (fgets(buf,1024,fh)!=NULL) |
| 894 | +while (fgets(buf,sizeof(buf),fh)!=NULL) |
895 | 895 | { |
896 | | -/*Find acomment */ |
| 896 | +/*Truncate line atcomment, if any */ |
897 | 897 | cmnt=strchr(buf,';'); |
898 | | -if (cmnt==buf) |
899 | | -continue; |
900 | | - |
901 | | -/* End string at comment */ |
902 | 898 | if (cmnt!=NULL) |
903 | 899 | cmnt[0]='\0'; |
904 | 900 |
|
905 | | -/*Skip if allspaces */ |
906 | | -if (strspn(buf," \t")==strlen(buf)) |
| 901 | +/*Ignore if allblank */ |
| 902 | +if (strspn(buf," \t\r")==strlen(buf)) |
907 | 903 | continue; |
908 | 904 |
|
909 | | -/* Get an ID */ |
| 905 | +/* Get an ID, check it's valid and not already seen */ |
910 | 906 | id=strtol(buf,&endptr,10); |
911 | | -if (endptr==buf||id <=0||id>AH->maxDumpId) |
| 907 | +if (endptr==buf||id <=0||id>AH->maxDumpId|| |
| 908 | +ropt->idWanted[id-1]) |
912 | 909 | { |
913 | 910 | write_msg(modulename,"WARNING: line ignored: %s\n",buf); |
914 | 911 | continue; |
|