- if(longest_prefix_length>0)
- { /* Mount point found, split fullpath into mount_name and path+filename*/
- path = (char *) xbt_malloc ((strlen(fullpath)-longest_prefix_length+1));
- mount_name = (char *) xbt_malloc ((longest_prefix_length+1));
- strncpy(mount_name, fullpath, longest_prefix_length+1);
- strncpy(path, fullpath+longest_prefix_length, strlen(fullpath)-longest_prefix_length+1);
- path[strlen(fullpath)-longest_prefix_length] = '\0';
- mount_name[longest_prefix_length] = '\0';
- }
- else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->name().c_str());
-
- XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
- Action *action = st->open((const char*)mount_name, (const char*)path);
- free((char*)path);
- free((char*)mount_name);
+ if (longest_prefix_length > 0) { /* Mount point found, split fullpath into mount_name and path+filename*/
+ mount_name = std::string(fullpath).substr(0, longest_prefix_length);
+ path = std::string(fullpath).substr(longest_prefix_length, strlen(fullpath));
+ } else
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->cname());
+
+ XBT_DEBUG("OPEN %s on disk '%s'", path.c_str(), st->cname());
+ Action* action = st->open(mount_name.c_str(), path.c_str());