浏览代码

Improved subversion 1.7 revision detecting. Followup r15211.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15212 54d463be-8e91-2dee-dedb-b68131a5f0ec
xazax-hun 13 年之前
父节点
当前提交
18349c6583
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/common/core.c

+ 4 - 3
src/common/core.c

@@ -175,11 +175,12 @@ const char* get_svn_revision(void)
 	}
 	/**
 	 * subversion 1.7 introduces the use of a .db file to store it, and we go through it
+	 * TODO: In some cases it may be not accurate
 	 **/
-	if(!(*eA_svn_version) && ((fp = fopen(".svn/wc.db", "r")) != NULL || (fp = fopen("../.svn/wc.db", "r")) != NULL)) {
-		char lines[512];
+	if(!(*eA_svn_version) && ((fp = fopen(".svn/wc.db", "rb")) != NULL || (fp = fopen("../.svn/wc.db", "rb")) != NULL)) {
+		char lines[64];
 		int revision,last_known = 0;
-		while(fgets(lines, sizeof(lines), fp)) {
+		while(fread(lines, sizeof(char), sizeof(lines), fp)) {
 			if( strstr(lines,"!svn/ver/") ) {
 				if (sscanf(strstr(lines,"!svn/ver/"),"!svn/ver/%d/%*s", &revision) == 1) {
 					if( revision > last_known ) {