GUAC-515: Clarify comments and formatting. Use simpler mkdir() logic.

This commit is contained in:
Michael Jumper 2015-07-28 14:36:08 -07:00
parent 52084f4f1f
commit 736ec7da23
2 changed files with 10 additions and 9 deletions

View File

@ -40,20 +40,20 @@
#include <guacamole/object.h> #include <guacamole/object.h>
#include <guacamole/pool.h> #include <guacamole/pool.h>
guac_rdp_fs* guac_rdp_fs_alloc(guac_client* client, const char* drive_path, int create_drive_path) { guac_rdp_fs* guac_rdp_fs_alloc(guac_client* client, const char* drive_path,
int create_drive_path) {
/* Create drive path if it does not exist */ /* Create drive path if it does not exist */
if (create_drive_path) { if (create_drive_path) {
guac_client_log(client, GUAC_LOG_DEBUG, guac_client_log(client, GUAC_LOG_DEBUG,
"%s: Creating directory \"%s\".", "%s: Creating directory \"%s\" if necessary.",
__func__, drive_path); __func__, drive_path);
if (mkdir(drive_path, S_IRWXU)) { /* Log error if directory creation fails */
if (errno != EEXIST) { if (mkdir(drive_path, S_IRWXU) && errno != EEXIST) {
guac_client_log(client, GUAC_LOG_DEBUG, guac_client_log(client, GUAC_LOG_ERROR,
"%s: mkdir() failed: %s", "Unable to create directory \"%s\": %s",
__func__, strerror(errno)); drive_path, strerror(errno));
}
} }
} }

View File

@ -156,7 +156,8 @@ typedef struct guac_rdp_settings {
char* drive_path; char* drive_path;
/** /**
* Whether to automatically create the local system path if it does not exist. * Whether to automatically create the local system path if it does not
* exist.
*/ */
int create_drive_path; int create_drive_path;