Subversion Repositories HelenOS

Rev

Rev 3651 | Rev 3816 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3651 Rev 3815
Line 32... Line 32...
32
#include <stdlib.h>
32
#include <stdlib.h>
33
#include <unistd.h>
33
#include <unistd.h>
34
#include <getopt.h>
34
#include <getopt.h>
35
#include <string.h>
35
#include <string.h>
36
#include <fcntl.h>
36
#include <fcntl.h>
37
#include <assert.h>
-
 
38
#include "config.h"
37
#include "config.h"
39
#include "util.h"
38
#include "util.h"
40
#include "errors.h"
39
#include "errors.h"
41
#include "entry.h"
40
#include "entry.h"
42
#include "cp.h"
41
#include "cp.h"
Line 122... Line 121...
122
            bytes = write(fd2, buff, res);
121
            bytes = write(fd2, buff, res);
123
            if (bytes < 0)
122
            if (bytes < 0)
124
                goto err;
123
                goto err;
125
            res -= bytes;
124
            res -= bytes;
126
        } while (res > 0);
125
        } while (res > 0);
-
 
126
 
-
 
127
        /* TODO: re-insert assert() once this is stand alone,
-
 
128
         * removed as abort() exits the entire shell
-
 
129
         */
127
        assert(res == 0);
130
        if (res != 0) {
-
 
131
            printf("\n%d more bytes than actually exist were copied\n", res);
-
 
132
            goto err;
-
 
133
        }
128
    }
134
    }
129
 
135
 
130
    if (bytes < 0) {
136
    if (bytes < 0) {
131
err:
137
err:
132
        printf("Error copying %s, (%d)\n", src, bytes);
138
        printf("\nError copying %s, (%d)\n", src, bytes);
133
        copied = bytes;
139
        copied = bytes;
134
    }
140
    }
135
 
141
 
136
out:
142
out:
137
    close(fd1);
143
    close(fd1);