• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

oga's tools


Commit MetaInfo

修订版178e8b7d547b5ae69023f32c464fbef6e74ceb61 (tree)
时间2019-09-23 08:36:23
作者oga <hyperoga@gmai...>
Commiteroga

Log Message

DU V1.15 skip access denied error

更改概述

差异

--- a/du.c
+++ b/du.c
@@ -10,6 +10,8 @@
1010 * 02/10/02 V1.12 -d (depth) support
1111 * 05/08/31 V1.13 support large size dir
1212 * 08/06/15 V1.14 support over 4gb file
13+ * 19/09/23 V1.15 skip access denied error, and expand size format
14+ *
1315 */
1416 #include <windows.h>
1517 #include <stdio.h>
@@ -18,7 +20,7 @@
1820 #include <sys/types.h>
1921
2022 /* macros */
21-#define VER "1.14"
23+#define VER "1.15"
2224 #define IS_DOT(str) (!strcmp(str,".") || !strcmp(str,".."))
2325
2426 #define dprintf if (vf) printf
@@ -262,7 +264,13 @@ void Du(char *path)
262264
263265 fh = FindFirstFile(wk,&wfd);
264266 if (fh == INVALID_HANDLE_VALUE) {
265- printf("du: FindFirstFile(%s) Error code=%d\n",wk,GetLastError());
267+ int lastst;
268+ lastst = GetLastError();
269+ /* V1.15-C start */
270+ if (vf >= 2 || lastst != ERROR_ACCESS_DENIED) {
271+ printf("du: FindFirstFile(%s) Error code=%d\n",wk,lastst);
272+ }
273+ /* V1.15-C end */
266274 /* exit(1); */
267275 depth--; /* V1.11-A */
268276 return; /* V1.11-C */
@@ -334,7 +342,7 @@ void Du(char *path)
334342 #ifdef OLD
335343 printf("%7d",(totalb-tsvb)/1024);
336344 #else
337- printf("%7d", ans); /* V1.13-C */
345+ printf("%9d", ans); /* V1.13-C V1.15-C */
338346 #endif
339347 if (af) {
340348 #ifdef OLD
@@ -343,7 +351,7 @@ void Du(char *path)
343351 memcpy(&work64, &total64, sizeof(u_long64)); /* V1.13-A */
344352 sub64(&work64, &tsv64); /* V1.13-A */
345353 dev1024(&work64, &ans); /* V1.13-A */
346- printf(" (%7d)", ans); /* V1.13-C */
354+ printf(" (%9d)", ans); /* V1.13-C V1.15-C */
347355 #endif
348356 }
349357 printf(" %s\n",path);
@@ -352,3 +360,4 @@ void Du(char *path)
352360
353361 } /* End Du() */
354362
363+// vim:ts=8