Re: Hdup error "No such file or directory"

Miek Gieben <[email protected]> Tue, 9 Sep 2003 11:34:32 +0200
Newsgroups gmane.comp.sysutils.backup.hdup.devel
Message-ID <[email protected]>
[On 09 Sep, @11:30, Tom wrote in "Re: [hdup-dev] Hdup error "No  ..."]
> > | No such file or directory.
> > 
> > The system call that matches according to Strace is:
> > | 856   open("/backup/nova/08-09-2003/nova.08-09-2003.daily.tar.gz", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory)
> 
> *wow* pretty lame, I do not check the return code from mkdir. 
> adding it as we speak...

try this and see what happens:

Index: hduplib.c
===================================================================
RCS file: /var/cvs/hdup16/src/hduplib.c,v
retrieving revision 1.66
diff -u -r1.66 hduplib.c
--- hduplib.c   5 Sep 2003 17:34:00 -0000       1.66
+++ hduplib.c   9 Sep 2003 09:33:40 -0000
@@ -878,8 +878,11 @@
     /* we can go 1 step too far with t++ */
     for ( t = d ; *t != '\0' && (int)(t-d) <= l; t++ ) {
         if ( *t == '/' ) {
-            *t = '\0'; /* make mkdir think the string stop here */
-            mkdir(d, mode);
+            *t = '\0'; /* make mkdir think the string stops here */
+            if ( mkdir(d, mode) != 0 ) {
+                   /* some erorr has happened - bail out */
+                   FATAL("%s: %s","Could not create directory", d);
+           }
             if ( user != NULL ) 
                 hdup_chown(d,user);
             *t = '/'; /* go on with the loop */