Revision 00ec5c37 hw/virtio-9p-local.c
b/hw/virtio-9p-local.c | ||
---|---|---|
207 | 207 |
return 0; |
208 | 208 |
} |
209 | 209 |
|
210 |
static int local_mkdir(FsContext *ctx, const char *path, mode_t mode)
|
|
210 |
static int local_mkdir(FsContext *fs_ctx, const char *path, FsCred *credp)
|
|
211 | 211 |
{ |
212 |
return mkdir(rpath(ctx, path), mode); |
|
212 |
int err = -1; |
|
213 |
int serrno = 0; |
|
214 |
|
|
215 |
/* Determine the security model */ |
|
216 |
if (fs_ctx->fs_sm == SM_MAPPED) { |
|
217 |
err = mkdir(rpath(fs_ctx, path), SM_LOCAL_DIR_MODE_BITS); |
|
218 |
if (err == -1) { |
|
219 |
return err; |
|
220 |
} |
|
221 |
credp->fc_mode = credp->fc_mode|S_IFDIR; |
|
222 |
err = local_set_xattr(rpath(fs_ctx, path), credp); |
|
223 |
if (err == -1) { |
|
224 |
serrno = errno; |
|
225 |
goto err_end; |
|
226 |
} |
|
227 |
} else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { |
|
228 |
err = mkdir(rpath(fs_ctx, path), credp->fc_mode); |
|
229 |
if (err == -1) { |
|
230 |
return err; |
|
231 |
} |
|
232 |
err = local_post_create_passthrough(fs_ctx, path, credp); |
|
233 |
if (err == -1) { |
|
234 |
serrno = errno; |
|
235 |
goto err_end; |
|
236 |
} |
|
237 |
} |
|
238 |
return err; |
|
239 |
|
|
240 |
err_end: |
|
241 |
remove(rpath(fs_ctx, path)); |
|
242 |
errno = serrno; |
|
243 |
return err; |
|
213 | 244 |
} |
214 | 245 |
|
215 | 246 |
static int local_fstat(FsContext *fs_ctx, int fd, struct stat *stbuf) |
Also available in: Unified diff