necouchman commented on code in PR #615: URL: https://github.com/apache/guacamole-server/pull/615#discussion_r2322279171
########## src/libguac/file.c: ########## @@ -0,0 +1,245 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "file-private.h" +#include "guacamole/error.h" +#include "guacamole/file.h" +#include "guacamole/mem.h" +#include "guacamole/string.h" + +#include <errno.h> +#include <fcntl.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +/** + * Creates the directory with the given path. Where possible (non-Windows + * platforms), this directory is given "rwxr-x---" (0750) permissions. If the + * directory cannot be created, errno is set appropriately. + * + * @param path + * The full path of the directory to create. + * + * @return + * Zero if the directory was created successfully, non-zero otherwise. + */ +static int guac_mkdir(const char* path) { +#ifndef __MINGW32__ Review Comment: Just one question/comment on this - I see you've consistently used the `#ifndef __MINGW32__` for specifying UNIX variants. Is there some reason you're doing it this way rather than `#ifdef __MINGW32__` for specifying stuff that applies to Windows, and using the `#else` for everything else (= UNIX)? It seems to me that, since Windows is the exception, you'd want to to capture it as the specific case, falling back to POSIX-compliant interfaces for everything that, you know, follows standards :laughing:? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
