int webgfarm_api_v1_create_dir(request_rec *r) { char *filepath = webgfarm_api_v1_getfilepath(r); if (filepath == NULL || strlen(filepath) == 0) { return HTTP_FORBIDDEN; } gfarm_error_t gerr; gerr = gfs_mkdir(filepath, 0777); if (gerr != GFARM_ERR_NO_ERROR) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "gfs_mkdir can not create a directory(%s) with error: %s", filepath, gfarm_error_string(gerr)); return HTTP_INTERNAL_SERVER_ERROR; } else { return OK; } }
int __mkdir(const char *path, mode_t mode) { const char *e; char *url; _gfs_hook_debug_v(fprintf(stderr, "Hooking __mkdir(%s, 0%o)\n", path, mode)); if (!gfs_hook_is_url(path, &url)) return syscall(SYS_mkdir, path, mode); _gfs_hook_debug(fprintf(stderr, "GFS: Hooking __mkdir(%s, 0%o)\n", path, mode)); e = gfs_mkdir(url, mode); free(url); if (e == NULL) return (0); _gfs_hook_debug(fprintf(stderr, "GFS: __mkdir: %s\n", e)); errno = gfarm_error_to_errno(e); return (-1); }