Rev 3425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3425 | Rev 4377 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | #include <stdio.h> |
31 | #include <stdio.h> |
32 | #include <stdlib.h> |
32 | #include <stdlib.h> |
33 | #include <unistd.h> |
33 | #include <unistd.h> |
34 | #include <fcntl.h> |
34 | #include <fcntl.h> |
35 | #include <dirent.h> |
35 | #include <dirent.h> |
36 | #include <assert.h> |
- | |
37 | #include <getopt.h> |
36 | #include <getopt.h> |
38 | 37 | ||
39 | #include "config.h" |
38 | #include "config.h" |
40 | #include "errors.h" |
39 | #include "errors.h" |
41 | #include "util.h" |
40 | #include "util.h" |
Line 215... | Line 214... | ||
215 | return CMD_FAILURE; |
214 | return CMD_FAILURE; |
216 | } |
215 | } |
217 | 216 | ||
218 | i = optind; |
217 | i = optind; |
219 | while (NULL != argv[i]) { |
218 | while (NULL != argv[i]) { |
220 | len = strlen(argv[i]) + 2; |
219 | len = str_size(argv[i]) + 2; |
221 | buff = (char *) realloc(buff, len); |
220 | buff = (char *) realloc(buff, len); |
222 | assert(buff != NULL); |
221 | if (buff == NULL) { |
- | 222 | printf("rm: out of memory\n"); |
|
- | 223 | ret = 1; |
|
- | 224 | break; |
|
- | 225 | } |
|
223 | memset(buff, 0, sizeof(buff)); |
226 | memset(buff, 0, sizeof(buff)); |
224 | snprintf(buff, len, argv[i]); |
227 | snprintf(buff, len, argv[i]); |
225 | 228 | ||
226 | scope = rm_scope(buff); |
229 | scope = rm_scope(buff); |
227 | switch (scope) { |
230 | switch (scope) { |