diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c index 72e0cf11fb3..80de40aa833 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c @@ -228,7 +228,7 @@ static int write_pid_to_cgroup_as_root(const char* cgroup_file, pid_t pid) { // open int cgroup_fd = open(cgroup_file, O_WRONLY | O_APPEND, 0); if (cgroup_fd == -1) { - fprintf(LOGFILE, "Can't open file %s as node manager - %s\n", cgroup_file, + fprintf(LOGFILE, "Failed to open file %s as node manager - %s\n", cgroup_file, strerror(errno)); rc = -1; goto cleanup; @@ -276,7 +276,7 @@ static int write_pid_to_file_as_nm(const char* pid_file, pid_t pid) { // create with 700 int pid_fd = open(temp_pid_file, O_WRONLY|O_CREAT|O_EXCL, S_IRWXU); if (pid_fd == -1) { - fprintf(LOGFILE, "Can't open file %s as node manager - %s\n", temp_pid_file, + fprintf(LOGFILE, "Failed to open file %s as node manager - %s\n", temp_pid_file, strerror(errno)); rc = -1; goto cleanup; @@ -297,7 +297,7 @@ static int write_pid_to_file_as_nm(const char* pid_file, pid_t pid) { // rename temp file to actual pid file // use rename as atomic if (rename(temp_pid_file, pid_file)) { - fprintf(LOGFILE, "Can't move pid file from %s to %s as node manager - %s\n", + fprintf(LOGFILE, "Failed to move pid file from %s to %s as node manager - %s\n", temp_pid_file, pid_file, strerror(errno)); unlink(temp_pid_file); rc = -1; @@ -339,7 +339,7 @@ static int write_exit_code_file_as_nm(const char* exit_code_file, // create with 700 int ecode_fd = open(tmp_ecode_file, O_WRONLY|O_CREAT|O_EXCL, S_IRWXU); if (ecode_fd == -1) { - fprintf(LOGFILE, "Can't open file %s - %s\n", tmp_ecode_file, + fprintf(LOGFILE, "Failed to open file %s - %s\n", tmp_ecode_file, strerror(errno)); rc = -1; goto cleanup; @@ -359,7 +359,7 @@ static int write_exit_code_file_as_nm(const char* exit_code_file, // rename temp file to actual exit code file // use rename as atomic if (rename(tmp_ecode_file, exit_code_file)) { - fprintf(LOGFILE, "Can't move exit code file from %s to %s - %s\n", + fprintf(LOGFILE, "Failed to move exit code file from %s to %s - %s\n", tmp_ecode_file, exit_code_file, strerror(errno)); unlink(tmp_ecode_file); rc = -1; @@ -388,7 +388,7 @@ static int wait_and_get_exit_code(pid_t pid) { } while (waitpid_result == -1 && errno == EINTR); if (waitpid_result < 0) { - fprintf(LOGFILE, "error waiting for process %" PRId64 " - %s\n", (int64_t)pid, strerror(errno)); + fprintf(LOGFILE, "Error waiting for process %" PRId64 " - %s\n", (int64_t)pid, strerror(errno)); return -1; } @@ -430,20 +430,20 @@ int change_user(uid_t user, gid_t group) { } if (seteuid(0) != 0) { - fprintf(LOGFILE, "unable to reacquire root - %s\n", strerror(errno)); + fprintf(LOGFILE, "Failed to reacquire root - %s\n", strerror(errno)); fprintf(LOGFILE, "Real: %d:%d; Effective: %d:%d\n", getuid(), getgid(), geteuid(), getegid()); return SETUID_OPER_FAILED; } if (setgid(group) != 0) { - fprintf(LOGFILE, "unable to set group to %d - %s\n", group, + fprintf(LOGFILE, "Failed to set group to %d - %s\n", group, strerror(errno)); fprintf(LOGFILE, "Real: %d:%d; Effective: %d:%d\n", getuid(), getgid(), geteuid(), getegid()); return SETUID_OPER_FAILED; } if (setuid(user) != 0) { - fprintf(LOGFILE, "unable to set user to %d - %s\n", user, strerror(errno)); + fprintf(LOGFILE, "Failed to set user to %d - %s\n", user, strerror(errno)); fprintf(LOGFILE, "Real: %d:%d; Effective: %d:%d\n", getuid(), getgid(), geteuid(), getegid()); return SETUID_OPER_FAILED; @@ -696,7 +696,7 @@ int create_validate_dir(const char* npath, mode_t perm, const char* path, if (stat(npath, &sb) != 0) { if (mkdir(npath, perm) != 0) { if (errno != EEXIST || stat(npath, &sb) != 0) { - fprintf(LOGFILE, "Can't create directory %s - %s\n", npath, + fprintf(LOGFILE, "Failed to create directory %s - %s\n", npath, strerror(errno)); return -1; } @@ -842,7 +842,7 @@ static struct passwd* get_user_info(const char* user) { if (getpwnam_r(user, buffer, ((char*)buffer) + sizeof(struct passwd), string_size, &result) != 0) { free(buffer); - fprintf(LOGFILE, "Can't get user information %s - %s\n", user, + fprintf(LOGFILE, "Failed to get user information %s - %s\n", user, strerror(errno)); return NULL; } @@ -896,7 +896,7 @@ struct passwd* check_user(const char *user) { return NULL; } if (user_info->pw_uid < min_uid && !is_whitelisted(user)) { - fprintf(LOGFILE, "Requested user %s is not whitelisted and has id %d," + fprintf(LOGFILE, "Requested user %s is not whitelisted and has id %d, " "which is below the minimum allowed %d\n", user, user_info->pw_uid, min_uid); free(user_info); return NULL; @@ -961,7 +961,7 @@ static int change_owner(const char* path, uid_t user, gid_t group) { #if defined(__FreeBSD__) || defined(__NetBSD__) if (chown(path, user, group) != 0) { - fprintf(LOGFILE, "Can't chown %s to %d:%d - %s\n", path, user, group, + fprintf(LOGFILE, "Failed to chown %s to %d:%d - %s\n", path, user, group, strerror(errno)); return -1; } @@ -977,7 +977,7 @@ static int change_owner(const char* path, uid_t user, gid_t group) { return -1; } if (chown(path, user, group) != 0) { - fprintf(LOGFILE, "Can't chown %s to %d:%d - %s\n", path, user, group, + fprintf(LOGFILE, "Failed to chown %s to %d:%d - %s\n", path, user, group, strerror(errno)); return -1; } @@ -1012,7 +1012,7 @@ int create_directory_for_user(const char* path) { strerror(errno)); ret = -1; } else if (chmod(path, permissions) != 0) { - fprintf(LOGFILE, "Can't chmod %s to add the sticky bit - %s\n", + fprintf(LOGFILE, "Failed to chmod %s to add the sticky bit - %s\n", path, strerror(errno)); ret = -1; } @@ -1042,7 +1042,7 @@ static int open_file_as_nm(const char* filename) { } int result = open(filename, O_RDONLY); if (result == -1) { - fprintf(LOGFILE, "Can't open file %s as node manager - %s\n", filename, + fprintf(LOGFILE, "Failed to open file %s as node manager - %s\n", filename, strerror(errno)); } if (change_effective_user(user, group)) { @@ -1069,7 +1069,7 @@ static int copy_file(int input, const char* in_filename, int out_fd = open(out_filename, O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW, perm); if (out_fd == -1) { - fprintf(LOGFILE, "Can't open %s for output - %s\n", out_filename, + fprintf(LOGFILE, "Failed to open %s for output - %s\n", out_filename, strerror(errno)); free(buffer); return -1; @@ -1119,7 +1119,7 @@ int initialize_user(const char *user, char* const* local_dirs) { for(local_dir_ptr = local_dirs; *local_dir_ptr != 0; ++local_dir_ptr) { user_dir = get_user_directory(*local_dir_ptr, user); if (user_dir == NULL) { - fprintf(LOGFILE, "Couldn't get userdir directory for %s.\n", user); + fprintf(LOGFILE, "Failed to get userdir directory for %s.\n", user); failed = 1; break; } @@ -1181,7 +1181,7 @@ char *init_log_path(const char *container_log_dir, const char *logfile) { free(tmp_buffer); tmp_buffer = NULL; } else if (chmod(tmp_buffer, permissions) != 0) { - fprintf(ERRORFILE, "Can't chmod %s - %s\n", + fprintf(ERRORFILE, "Failed to chmod %s - %s\n", tmp_buffer, strerror(errno)); free(tmp_buffer); tmp_buffer = NULL; @@ -1386,7 +1386,7 @@ int run_docker(const char *command_file) { int exit_code = -1; if (execvp(docker_binary, args) != 0) { - fprintf(ERRORFILE, "Couldn't execute the container launch with args %s - %s\n", + fprintf(ERRORFILE, "Failed to execute the container launch with args %s - %s\n", docker_binary, strerror(errno)); exit_code = DOCKER_RUN_FAILED; } else { @@ -1602,7 +1602,7 @@ int exec_container(const char *command_file) { ret = execve(binary, args, env); } if (ret != 0) { - fprintf(ERRORFILE, "Couldn't execute the container launch with args %s - %s\n", + fprintf(ERRORFILE, "Failed to execute the container launch with args %s - %s\n", binary, strerror(errno)); exit_code = DOCKER_EXEC_FAILED; } else { @@ -1637,7 +1637,7 @@ int exec_docker_command(char *docker_command, char **argv, int argc) { execvp(docker_binary, args); // will only get here if execvp fails - fprintf(ERRORFILE, "Couldn't execute the container launch with args %s - %s\n", + fprintf(ERRORFILE, "Failed to execute the container launch with args %s - %s\n", docker_binary, strerror(errno)); free(docker_binary); @@ -1657,14 +1657,14 @@ int create_script_paths(const char *work_dir, *script_file_dest = get_container_launcher_file(work_dir); if (script_file_dest == NULL) { exit_code = OUT_OF_MEMORY; - fprintf(ERRORFILE, "Could not create script_file_dest\n"); + fprintf(ERRORFILE, "Failed to create script_file_dest\n"); return exit_code; } *cred_file_dest = get_container_credentials_file(work_dir); if (NULL == cred_file_dest) { exit_code = OUT_OF_MEMORY; - fprintf(ERRORFILE, "Could not create cred_file_dest\n"); + fprintf(ERRORFILE, "Failed to create cred_file_dest\n"); return exit_code; } @@ -1672,13 +1672,13 @@ int create_script_paths(const char *work_dir, *keystore_file_dest = get_container_keystore_file(work_dir); if (NULL == keystore_file_dest) { exit_code = OUT_OF_MEMORY; - fprintf(ERRORFILE, "Could not create keystore_file_dest\n"); + fprintf(ERRORFILE, "Failed to create keystore_file_dest\n"); return exit_code; } *truststore_file_dest = get_container_truststore_file(work_dir); if (NULL == truststore_file_dest) { exit_code = OUT_OF_MEMORY; - fprintf(ERRORFILE, "Could not create truststore_file_dest\n"); + fprintf(ERRORFILE, "Failed to create truststore_file_dest\n"); return exit_code; } } @@ -1687,14 +1687,14 @@ int create_script_paths(const char *work_dir, *container_file_source = open_file_as_nm(script_name); if (*container_file_source == -1) { exit_code = INVALID_NM_ROOT_DIRS; - fprintf(ERRORFILE, "Could not open container file\n"); + fprintf(ERRORFILE, "Failed to open container file\n"); return exit_code; } // open credentials *cred_file_source = open_file_as_nm(cred_file); if (*cred_file_source == -1) { exit_code = INVALID_NM_ROOT_DIRS; - fprintf(ERRORFILE, "Could not open cred file\n"); + fprintf(ERRORFILE, "Failed to open cred file\n"); return exit_code; } @@ -1703,14 +1703,14 @@ int create_script_paths(const char *work_dir, *keystore_file_source = open_file_as_nm(keystore_file); if (*keystore_file_source == -1) { exit_code = INVALID_NM_ROOT_DIRS; - fprintf(ERRORFILE, "Could not open keystore file\n"); + fprintf(ERRORFILE, "Failed to open keystore file\n"); return exit_code; } // open truststore *truststore_file_source = open_file_as_nm(truststore_file); if (*truststore_file_source == -1) { exit_code = INVALID_NM_ROOT_DIRS; - fprintf(ERRORFILE, "Could not open truststore file\n"); + fprintf(ERRORFILE, "Failed to open truststore file\n"); return exit_code; } } @@ -1734,19 +1734,19 @@ int create_local_dirs(const char * user, const char *app_id, // create the user directory on all disks int result = initialize_user(user, local_dirs); if (result != 0) { - fprintf(ERRORFILE, "Could not create user dir\n"); + fprintf(ERRORFILE, "Failed to create user dir\n"); return result; } // initializing log dirs int log_create_result = create_log_dirs(app_id, log_dirs); if (log_create_result != 0) { - fprintf(ERRORFILE, "Could not create log dirs\n"); + fprintf(ERRORFILE, "Failed to create log dirs\n"); return log_create_result; } if (effective_user == 1) { if (change_effective_user(user_detail->pw_uid, user_detail->pw_gid) != 0) { - fprintf(ERRORFILE, "Could not change to effective users %d, %d\n", user_detail->pw_uid, user_detail->pw_gid); + fprintf(ERRORFILE, "Failed to change to effective users %d, %d\n", user_detail->pw_uid, user_detail->pw_gid); goto cleanup; } } else { @@ -1771,14 +1771,14 @@ int create_local_dirs(const char * user, const char *app_id, int directory_create_result = create_container_directories(user, app_id, container_id, local_dirs, log_dirs, work_dir); if (directory_create_result != 0) { - fprintf(ERRORFILE, "Could not create container dirs\n"); + fprintf(ERRORFILE, "Failed to create container dirs\n"); exit_code = directory_create_result; goto cleanup; } // Copy script file with permissions 700 if (copy_file(container_file_source, script_name, script_file_dest,S_IRWXU) != 0) { - fprintf(ERRORFILE, "Could not create copy file %s %s (%d)\n", script_name, script_file_dest, container_file_source); + fprintf(ERRORFILE, "Failed to create copy file %s %s (%d)\n", script_name, script_file_dest, container_file_source); exit_code = COULD_NOT_CREATE_SCRIPT_COPY; goto cleanup; } @@ -1787,7 +1787,7 @@ int create_local_dirs(const char * user, const char *app_id, if (copy_file(cred_file_source, cred_file, cred_file_dest, S_IRUSR | S_IWUSR) != 0) { exit_code = COULD_NOT_CREATE_CREDENTIALS_COPY; - fprintf(ERRORFILE, "Could not copy file\n"); + fprintf(ERRORFILE, "Failed to copy file\n"); goto cleanup; } @@ -1796,7 +1796,7 @@ int create_local_dirs(const char * user, const char *app_id, if (copy_file(keystore_file_source, keystore_file, keystore_file_dest, S_IRUSR | S_IWUSR) != 0) { exit_code = COULD_NOT_CREATE_KEYSTORE_COPY; - fprintf(ERRORFILE, "Could not copy file\n"); + fprintf(ERRORFILE, "Failed to copy file\n"); goto cleanup; } @@ -1804,13 +1804,13 @@ int create_local_dirs(const char * user, const char *app_id, if (copy_file(truststore_file_source, truststore_file, truststore_file_dest, S_IRUSR | S_IWUSR) != 0) { exit_code = COULD_NOT_CREATE_TRUSTSTORE_COPY; - fprintf(ERRORFILE, "Could not copy file\n"); + fprintf(ERRORFILE, "Failed to copy file\n"); goto cleanup; } } if (chdir(work_dir) != 0) { - fprintf(ERRORFILE, "Can't change directory to %s -%s\n", work_dir, + fprintf(ERRORFILE, "Failed to change directory to %s -%s\n", work_dir, strerror(errno)); goto cleanup; } @@ -1826,7 +1826,7 @@ int create_user_filecache_dirs(const char * user, char* const* local_dirs) { for(char* const* ldir_p = local_dirs; *ldir_p != 0; ++ldir_p) { char* filecache_dir = get_user_filecache_directory(*ldir_p, user); if (filecache_dir == NULL) { - fprintf(LOGFILE, "Couldn't get user filecache directory for %s.\n", user); + fprintf(LOGFILE, "Failed to get user filecache directory for %s.\n", user); rc = INITIALIZE_USER_FAILED; break; } @@ -1906,19 +1906,19 @@ int launch_docker_container_as_user(const char * user, const char *app_id, 1, script_file_dest, cred_file_dest, keystore_file_dest, truststore_file_dest, container_file_source, cred_file_source, keystore_file_source, truststore_file_source); if (exit_code != 0) { - fprintf(ERRORFILE, "Could not create local files and directories %d %d\n", container_file_source, cred_file_source); + fprintf(ERRORFILE, "Failed to create local files and directories %d %d\n", container_file_source, cred_file_source); goto cleanup; } exit_code = create_user_filecache_dirs(user, local_dirs); if (exit_code != 0) { - fprintf(ERRORFILE, "Could not create user filecache directory\n"); + fprintf(ERRORFILE, "Failed to create user filecache directory\n"); goto cleanup; } exit_code = create_yarn_sysfs(user, app_id, container_id, work_dir, local_dirs); if (exit_code != 0) { - fprintf(ERRORFILE, "Could not create user yarn sysfs directory\n"); + fprintf(ERRORFILE, "Failed to create user yarn sysfs directory\n"); exit(-1); goto cleanup; } @@ -1936,7 +1936,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, fprintf(LOGFILE, "Changing effective user to root...\n"); if (change_effective_user(0, user_gid) != 0) { - fprintf(ERRORFILE, "Could not change to effective users %d, %d\n", 0, user_gid); + fprintf(ERRORFILE, "Failed to change to effective users %d, %d\n", 0, user_gid); goto cleanup; } @@ -1958,7 +1958,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, pid_t child_pid = fork(); if (child_pid == -1) { fprintf (ERRORFILE, - "Could not invoke docker %s.\n", docker_command_with_binary); + "Failed to invoke docker %s.\n", docker_command_with_binary); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; goto cleanup; } @@ -1966,13 +1966,13 @@ int launch_docker_container_as_user(const char * user, const char *app_id, if (child_pid == 0) { FILE* so_fd = fopen(so, "a+"); if (so_fd == NULL) { - fprintf(ERRORFILE, "Could not append to %s\n", so); + fprintf(ERRORFILE, "Failed to append to %s\n", so); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; goto cleanup; } FILE* se_fd = fopen(se, "a+"); if (se_fd == NULL) { - fprintf(ERRORFILE, "Could not append to %s\n", se); + fprintf(ERRORFILE, "Failed to append to %s\n", se); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; fclose(so_fd); goto cleanup; @@ -1983,12 +1983,12 @@ int launch_docker_container_as_user(const char * user, const char *app_id, fprintf(so_fd, "Launching docker container...\n"); fprintf(so_fd, "Docker run command: %s\n", docker_command_with_binary); if (dup2(fileno(so_fd), fileno(stdout)) == -1) { - fprintf(ERRORFILE, "Could not append to stdout.txt\n"); + fprintf(ERRORFILE, "Failed to append to stdout.txt\n"); fclose(so_fd); return UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; } if (dup2(fileno(se_fd), fileno(stderr)) == -1) { - fprintf(ERRORFILE, "Could not append to stderr.txt\n"); + fprintf(ERRORFILE, "Failed to append to stderr.txt\n"); fclose(se_fd); return UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; } @@ -1996,7 +1996,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, fclose(so_fd); fclose(se_fd); execvp(docker_binary, docker_command); - fprintf(ERRORFILE, "failed to execute docker command! error: %s\n", strerror(errno)); + fprintf(ERRORFILE, "Failed to execute docker command! error: %s\n", strerror(errno)); return UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; } else { if (use_entry_point) { @@ -2016,7 +2016,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, fprintf(LOGFILE, "pid from docker inspect: %d\n", pid); if (pclose (inspect_docker) != 0 || res <= 0) { fprintf (ERRORFILE, - "Could not inspect docker to get pid %s.\n", docker_inspect_command); + "Failed to inspect docker to get pid %s.\n", docker_inspect_command); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; } else { if (pid != 0) { @@ -2048,7 +2048,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, if (pclose (inspect_docker) != 0 || res <= 0) { fprintf (ERRORFILE, - "Could not inspect docker to get pid %s.\n", docker_inspect_command); + "Failed to inspect docker to get pid %s.\n", docker_inspect_command); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; goto cleanup; } @@ -2059,7 +2059,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, if (pid_file == NULL || write_pid_to_file_as_nm(pid_file, (pid_t)pid) != 0) { exit_code = WRITE_PIDFILE_FAILED; - fprintf(ERRORFILE, "Could not write pid to %s\n", pid_file); + fprintf(ERRORFILE, "Failed to write pid to %s\n", pid_file); goto cleanup; } @@ -2093,7 +2093,7 @@ int launch_docker_container_as_user(const char * user, const char *app_id, FILE* inspect_exitcode_docker = popen(docker_inspect_exitcode_command, "r"); res = fscanf (inspect_exitcode_docker, "%d", &exit_code); if (pclose (inspect_exitcode_docker) != 0 || res <= 0) { - fprintf (ERRORFILE, "Could not inspect docker to get Exit code %s.\n", docker_inspect_exitcode_command); + fprintf (ERRORFILE, "Failed to inspect docker to get Exit code %s.\n", docker_inspect_exitcode_command); exit_code = -1; } else { if (exit_code != 0) { @@ -2109,14 +2109,14 @@ cleanup: if (exit_code_file != NULL && write_exit_code_file_as_nm(exit_code_file, exit_code) < 0) { fprintf (ERRORFILE, - "Could not write exit code to file %s.\n", exit_code_file); + "Failed to write exit code to file %s.\n", exit_code_file); } fprintf(LOGFILE, "Wrote the exit code %d to %s\n", exit_code, exit_code_file); // Drop root privileges if (change_effective_user(prev_uid, user_gid) != 0) { fprintf(ERRORFILE, - "Could not change to effective users %d, %d\n", prev_uid, user_gid); + "Failed to change to effective users %d, %d\n", prev_uid, user_gid); } #if HAVE_FCLOSEALL @@ -2173,7 +2173,7 @@ int launch_container_as_user(const char *user, const char *app_id, work_dir, script_name, cred_file, https, keystore_file, truststore_file, &script_file_dest, &cred_file_dest, &keystore_file_dest, &truststore_file_dest, &container_file_source, &cred_file_source, &keystore_file_source, &truststore_file_source); if (exit_code != 0) { - fprintf(ERRORFILE, "Could not create local files and directories\n"); + fprintf(ERRORFILE, "Failed to create local files and directories\n"); goto cleanup; } @@ -2222,7 +2222,7 @@ int launch_container_as_user(const char *user, const char *app_id, 0, script_file_dest, cred_file_dest, keystore_file_dest, truststore_file_dest, container_file_source, cred_file_source, keystore_file_source, truststore_file_source); if (exit_code != 0) { - fprintf(ERRORFILE, "Could not create local files and directories\n"); + fprintf(ERRORFILE, "Failed to create local files and directories\n"); goto cleanup; } @@ -2241,7 +2241,7 @@ int launch_container_as_user(const char *user, const char *app_id, umask(0027); if (execlp(script_file_dest, script_file_dest, NULL) != 0) { - fprintf(LOGFILE, "Couldn't execute the container launch file %s - %s\n", + fprintf(LOGFILE, "Failed to execute the container launch file %s - %s\n", script_file_dest, strerror(errno)); exit_code = UNABLE_TO_EXECUTE_CONTAINER_SCRIPT; goto cleanup; @@ -2398,7 +2398,7 @@ static int recursive_unlink_helper(int dirfd, const char *name, // is_dir_helper determined that the path is not a directory. ret = unlink_helper(dirfd, name, 0); if (ret) { - fprintf(LOGFILE, "failed to unlink %s: %s\n", + fprintf(LOGFILE, "Failed to unlink %s: %s\n", fullpath, strerror(ret)); } goto done; @@ -2435,13 +2435,13 @@ static int recursive_unlink_helper(int dirfd, const char *name, ret = 0; goto done; } - fprintf(LOGFILE, "failed to stat %s: %s\n", fullpath, strerror(ret)); + fprintf(LOGFILE, "Failed to stat %s: %s\n", fullpath, strerror(ret)); goto done; } if (!(S_ISDIR(stat.st_mode))) { ret = unlink_helper(dirfd, name, 0); if (ret) { - fprintf(LOGFILE, "failed to unlink %s: %s\n", fullpath, strerror(ret)); + fprintf(LOGFILE, "Failed to unlink %s: %s\n", fullpath, strerror(ret)); goto done; } } else { @@ -2504,7 +2504,7 @@ static int recursive_unlink_helper(int dirfd, const char *name, if (dirfd != -1) { ret = unlink_helper(dirfd, name, AT_REMOVEDIR); if (ret) { - fprintf(LOGFILE, "failed to rmdir %s: %s\n", name, strerror(ret)); + fprintf(LOGFILE, "Failed to rmdir %s: %s\n", name, strerror(ret)); goto done; } } @@ -2558,7 +2558,7 @@ static int delete_path(const char *full_path, if (rmdir(full_path) != 0) { ret = errno; if (ret != ENOENT) { - fprintf(LOGFILE, "Couldn't delete directory %s - %s\n", + fprintf(LOGFILE, "Failed to delete directory %s - %s\n", full_path, strerror(ret)); return -1; } @@ -2594,7 +2594,7 @@ int delete_as_user(const char *user, // Ignore missing dir. Continue deleting other directories. continue; } else { - fprintf(LOGFILE, "Could not stat %s - %s\n", *ptr, strerror(errno)); + fprintf(LOGFILE, "Failed to stat %s - %s\n", *ptr, strerror(errno)); return -1; } } @@ -2633,7 +2633,7 @@ int list_as_user(const char *target_dir) { if (stat(target_dir, &sb) != 0) { // If directory doesn't exist or can't be accessed, error out - fprintf(LOGFILE, "Could not stat %s - %s\n", target_dir, + fprintf(LOGFILE, "Failed to stat %s - %s\n", target_dir, strerror(errno)); ret = -1; } else if (!S_ISDIR(sb.st_mode)) { @@ -2660,12 +2660,12 @@ int list_as_user(const char *target_dir) { // If we ended the directory read early on an error, then error out if (errno != 0) { - fprintf(LOGFILE, "Could not read directory %s - %s\n", target_dir, + fprintf(LOGFILE, "Failed to read directory %s - %s\n", target_dir, strerror(errno)); ret = -1; } } else { - fprintf(LOGFILE, "Could not open directory %s - %s\n", target_dir, + fprintf(LOGFILE, "Failed to open directory %s - %s\n", target_dir, strerror(errno)); ret = -1; } @@ -2709,7 +2709,7 @@ int is_empty(char *target_dir) { struct dirent *entry = NULL; dir = opendir(target_dir); if (!dir) { - fprintf(LOGFILE, "Could not open directory %s - %s\n", target_dir, + fprintf(LOGFILE, "Failed to open directory %s - %s\n", target_dir, strerror(errno)); return 0; } @@ -2829,14 +2829,14 @@ static int run_traffic_control(const char *opts[], char *command_file) { if (child_pid != 0) { int exit_code = wait_and_get_exit_code(child_pid); if (exit_code != 0) { - fprintf(LOGFILE, "failed to execute tc command!\n"); + fprintf(LOGFILE, "Failed to execute tc command!\n"); return TRAFFIC_CONTROL_EXECUTION_FAILED; } return 0; } else { execv(TC_BIN, (char**)args); //if we reach here, exec failed - fprintf(LOGFILE, "failed to execute tc command! error: %s\n", strerror(errno)); + fprintf(LOGFILE, "Failed to execute tc command! error: %s\n", strerror(errno)); return TRAFFIC_CONTROL_EXECUTION_FAILED; } }