comparison rvinterf/etmsync/fsread.c @ 276:d332fbf5c145

etmsync: host_mkdir() function factored out of fc-fsio
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Nov 2017 00:26:09 +0000
parents 46ad66a231af
children 74d284add54d
comparison
equal deleted inserted replaced
275:81da9717babe 276:d332fbf5c145
201 } 201 }
202 fclose(of); 202 fclose(of);
203 return fd_close(tfd); 203 return fd_close(tfd);
204 } 204 }
205 205
206 host_mkdir(pathname)
207 char *pathname;
208 {
209 int rc;
210 struct stat st;
211
212 rc = stat(pathname, &st);
213 if (rc < 0) {
214 rc = mkdir(pathname, 0777);
215 if (rc < 0) {
216 perror(pathname);
217 return(ERROR_UNIX);
218 }
219 return(0);
220 } else {
221 if (S_ISDIR(st.st_mode))
222 return(0);
223 else {
224 fprintf(stderr,
225 "error: %s already exists and is not a directory\n",
226 pathname);
227 return(ERROR_UNIX);
228 }
229 }
230 }
231
232 cpout_dir(ffspath_dir, hostpath_dir) 206 cpout_dir(ffspath_dir, hostpath_dir)
233 char *ffspath_dir, *hostpath_dir; 207 char *ffspath_dir, *hostpath_dir;
234 { 208 {
235 u_char rdstate[4]; 209 u_char rdstate[4];
236 char rdbuf[MAX_FN_COMPONENT+1], ffspath_child[MAX_FULL_PATHNAME+1]; 210 char rdbuf[MAX_FN_COMPONENT+1], ffspath_child[MAX_FULL_PATHNAME+1];