瀏覽代碼

Z991239-1812 #comment fix: 修复解压的部分逻辑判断

刘文涛80174520 4 年之前
父節點
當前提交
179e9a32ad
共有 2 個文件被更改,包括 28 次插入26 次删除
  1. 26 25
      Module/mod_UpgradeRun/XUnZipZilb.cpp
  2. 2 1
      Module/mod_UpgradeRun/XUnZipZilb.h

+ 26 - 25
Module/mod_UpgradeRun/XUnZipZilb.cpp

@@ -177,7 +177,7 @@ int unZipCurrentFile(zipFile zf, string destDirPath)
 				Dbg("error %d with zipfile in unzCloseCurrentFile", err);
 				return -1;
 			}
-			if (changeFileAtt(fileNamePath.c_str())!=0) {
+			if (changeUnZipFileAtt(fileNamePath.c_str())!=0) {
 				return -1;
 			}
 			return 0;
@@ -252,6 +252,30 @@ bool is_str_utf8(const char* str)
 	return true;
 }
 
+int changeUnZipFileAtt(const char* path)
+{
+#ifdef RVC_OS_WIN
+	return 0;//windows 默认返回成功
+#else
+	struct stat attr_of_del;
+	if (lstat(path, &attr_of_del) == 0)
+	{
+		//修改为775属性
+		mode_t f_attrib = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
+		if (chmod(path, f_attrib) != 0)
+		{
+			Dbg("set file attribute is fail,errno=%d, file=%s", errno, path);
+			return -1;
+		}
+		return 0;
+	}
+	else {
+		Dbg("get file attribute is fail,errno=%d, file=%s", errno, path);
+		return -1;
+	}
+#endif
+}
+
 #ifdef RVC_OS_WIN
 #else
 unsigned char* utf8_string_create(const char* string) {
@@ -291,27 +315,4 @@ unsigned char* utf8_string_create(const char* string) {
 	return string_utf8;
 }
 
-int changeFileAtt(const char* path)
-{
-#ifdef RVC_OS_WIN
-	return 0;//windows 默认返回成功
-#else
-	struct stat attr_of_del;
-	if (lstat(path, &attr_of_del) == 0)
-	{
-		//修改为775属性
-		mode_t f_attrib = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
-		if (chmod(path, f_attrib) != 0)
-		{
-			Dbg("set file attribute is fail,errno=%d, file=%s", errno, path);
-			return -1;
-		}
-		return 0;
-	}
-	else {
-		Dbg("get file attribute is fail,errno=%d, file=%s", errno, path);
-		return -1;
-	}
-#endif
-}
-#endif //RVC_OS_WIN
+#endif //RVC_OS_WIN

+ 2 - 1
Module/mod_UpgradeRun/XUnZipZilb.h

@@ -64,10 +64,11 @@ int unZipCurrentFile(zipFile zf, string destDirPath);
 
 bool is_str_utf8(const char* str);
 
+int changeUnZipFileAtt(const char* path);
 #ifdef RVC_OS_WIN
 #else
 unsigned char* utf8_string_create(const char* string);
-int changeFileAtt(const char* path);
+
 #endif // RVC_OS_WIN
 
 #endif //RVC_MOD_UPLOAD_XUNZIP_ZLIB_H_