Skip to content

Commit

Permalink
fix copy user data file
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Montes committed Apr 15, 2016
1 parent e3a5bf3 commit 3d5ac4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/datasources/openstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,16 @@ static bool openstack_process_config_drive_metadata(void) {

static bool openstack_process_config_drive_userdata(void) {
int fd_tmp = 0;
struct stat st;
gchar userdata_drive_path[PATH_MAX] = { 0 };

g_snprintf(userdata_drive_path, PATH_MAX, "%s%s", config_drive_mount_path, OPENSTACK_USERDATA_FILE);

if (stat(userdata_drive_path, &st) != 0) {
LOG(MOD "User data file not found in config drive\n");
return false;
}

g_strlcpy(userdata_file, "/tmp/userdata-XXXXXX", PATH_MAX);

fd_tmp = mkstemp(userdata_file);
Expand All @@ -478,8 +486,6 @@ static bool openstack_process_config_drive_userdata(void) {
return false;
}

g_snprintf(userdata_drive_path, PATH_MAX, "%s%s", config_drive_mount_path, OPENSTACK_USERDATA_FILE);

if (!copy_file(userdata_drive_path, userdata_file)) {
LOG(MOD "Copy file '%s' failed\n", userdata_drive_path);
return false;
Expand Down

0 comments on commit 3d5ac4b

Please sign in to comment.