File: filesys_error_message.patch

package info (click to toggle)
boinc 8.2.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104,688 kB
  • sloc: cpp: 172,875; php: 115,929; pascal: 56,058; xml: 17,863; python: 8,752; javascript: 6,538; sh: 5,343; objc: 2,322; ansic: 2,200; makefile: 2,166; perl: 1,843; sql: 831; java: 429; lisp: 47; csh: 30
file content (28 lines) | stat: -rw-r--r-- 920 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: this patch adds an useful error message in case of dir open failure.
Index: boinc/lib/filesys.cpp
===================================================================
--- boinc.orig/lib/filesys.cpp
+++ boinc/lib/filesys.cpp
@@ -145,7 +145,12 @@ DIRREF dir_open(const char* p) {
     dirp->handle = INVALID_HANDLE_VALUE;
 #else
     dirp = opendir(p);
-    if (!dirp) return NULL;
+    if (!dirp) {
+        char b[MAXPATHLEN+1];
+        boinc_getcwd(b);
+        fprintf(stderr,"dir_open: Could not open directory '%s' from '%s'.\n",p,b);
+        return NULL;
+    }
 #endif
     return dirp;
 }
@@ -760,7 +765,7 @@
     //
     int retval = rename(old, newf);
     if (retval) {
-        char buf[MAXPATHLEN+MAXPATHLEN];
+        char buf[MAXPATHLEN+MAXPATHLEN+1+7];
         snprintf(buf, sizeof(buf), "mv \"%s\" \"%s\"", old, newf);
 #ifdef __APPLE__
         // system() is deprecated in Mac OS 10.10.