瀏覽代碼

tar2qfile: ignore EDQUOT error from dom0

dom0 will use quota enforcement to extract only backup header, so this
is normal situation in this tool.
Marek Marczykowski-Górecki 10 年之前
父節點
當前提交
1bd16d981c
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 8 0
      qubes-rpc/qfile-utils.c
  2. 4 0
      qubes-rpc/tar2qfile.c

+ 8 - 0
qubes-rpc/qfile-utils.c

@@ -3,6 +3,7 @@
 
 unsigned long crc32_sum;
 int ignore_symlinks = 0;
+int ignore_quota_error = 0;
 
 void notify_progress(int size, int flag)
 {
@@ -106,6 +107,13 @@ void wait_for_result()
 			case EINVAL:
 				gui_fatal("File copy: Corrupted data from packer%s%s", last_filename_prefix, last_filename);
 				break;
+			case EDQUOT:
+				if (ignore_quota_error) {
+					/* skip also CRC check as sender and receiver might be
+					 * desynchronized in this case */
+					return;
+				}
+				/* fall though */
 			default:
 				gui_fatal("File copy: %s%s%s",
 						strerror(hdr.error_code), last_filename_prefix, last_filename);

+ 4 - 0
qubes-rpc/tar2qfile.c

@@ -166,6 +166,7 @@ static unsigned long tar_chksm (char *, int);
 char *gnu_hack_string;          /* GNU ././@LongLink hackery */
 
 char untrusted_namebuf[MAX_PATH_LENGTH];
+extern int ignore_quota_error;
 
 
 /*
@@ -820,6 +821,9 @@ int main(int argc, char **argv)
 	//set_size_limit(1500000000, 2048);
 
 	crc32_sum = 0;
+	/* when extracting backup header, dom0 will terminate the transfer with
+	 * EDQUOT just after getting qubes.xml */
+	ignore_quota_error = 1;
 	for (i = 1; i < argc; i++) {
 		set_nonblock(0);
 		if (strcmp(argv[i], "--ignore-symlinks")==0) {