Mercurial > hg > toybox
comparison toys/posix/find.c @ 1571:e85e5f3b87c2 draft
As long as Android's going to require fortify, fixup the warnings it generates.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 22 Nov 2014 00:36:45 -0600 |
parents | 715c765cec61 |
children | 848969327d77 |
comparison
equal
deleted
inserted
replaced
1570:d2eb3c88a724 | 1571:e85e5f3b87c2 |
---|---|
70 // Perform pending -exec (if any) | 70 // Perform pending -exec (if any) |
71 static int flush_exec(struct dirtree *new, struct exec_range *aa) | 71 static int flush_exec(struct dirtree *new, struct exec_range *aa) |
72 { | 72 { |
73 struct double_list **dl; | 73 struct double_list **dl; |
74 char **newargs; | 74 char **newargs; |
75 int rc; | 75 int rc = 0; |
76 | 76 |
77 if (!aa->namecount) return 0; | 77 if (!aa->namecount) return 0; |
78 | 78 |
79 if (aa->dir && new->parent) dl = (void *)&new->parent->extra; | 79 if (aa->dir && new->parent) dl = (void *)&new->parent->extra; |
80 else dl = &aa->names; | 80 else dl = &aa->names; |
81 dlist_terminate(*dl); | 81 dlist_terminate(*dl); |
82 | 82 |
83 // switch to directory for -execdir, or back to top if we have an -execdir | 83 // switch to directory for -execdir, or back to top if we have an -execdir |
84 // _and_ a normal -exec, or are at top of tree in -execdir | 84 // _and_ a normal -exec, or are at top of tree in -execdir |
85 if (aa->dir && new->parent) fchdir(new->parent->data); | 85 if (aa->dir && new->parent) rc = fchdir(new->parent->data); |
86 else if (TT.topdir != -1) fchdir(TT.topdir); | 86 else if (TT.topdir != -1) rc = fchdir(TT.topdir); |
87 if (rc) { | |
88 perror_msg("%s", new->name); | |
89 | |
90 return rc; | |
91 } | |
87 | 92 |
88 // execdir: accumulated execs in this directory's children. | 93 // execdir: accumulated execs in this directory's children. |
89 newargs = xmalloc(sizeof(char *)*(aa->arglen+aa->namecount+1)); | 94 newargs = xmalloc(sizeof(char *)*(aa->arglen+aa->namecount+1)); |
90 if (aa->curly < 0) { | 95 if (aa->curly < 0) { |
91 memcpy(newargs, aa->argstart, sizeof(char *)*aa->arglen); | 96 memcpy(newargs, aa->argstart, sizeof(char *)*aa->arglen); |