Ejemplo n.º 1
0
/* get object file corresponding to src file */
char *
get_object_file (char *src)
{
	// bug 2025
	// Create .o files in /tmp in case the src dir is not writable.
	if (!(keep_flag || (ipa == TRUE) || remember_last_phase == P_any_as)) {
	  char *tmp_file = NULL;
	  char *obj_name = change_suffix(src, "o");
	  string_pair_item_t *p;
	  FOREACH_STRING_PAIR (p, temp_obj_files) {
	    if (strcmp (STRING_PAIR_KEY(p), obj_name) == 0)
	      return STRING_PAIR_VAL(p);
	  }
	  // Create temp file name as in create_temp_file_name.
	  tmp_file = concat_strings(tmpdir, "/cco.XXXXXX");
	  int fd = mkstemp(tmp_file);
      if(fd == -1) {
		error("mkstemp failed for template: %s", tmp_file);
        return NULL;
      }

	  close(fd);
	  add_string_pair (temp_obj_files, obj_name, tmp_file);
	  return tmp_file;
	}
Ejemplo n.º 2
0
/* get object file corresponding to src file */
char *
get_object_file (char *src)
{
	// bug 2025
	// Create .o files in /tmp in case the src dir is not writable.
	if (!(keep_flag || (ipa == TRUE) || remember_last_phase == P_any_as)) {
	  char *obj_name = change_suffix(src, "o");
	  string_pair_item_t *p;
	  FOREACH_STRING_PAIR (p, temp_obj_files) {
	    if (strcmp (STRING_PAIR_KEY(p), obj_name) == 0)
	      return STRING_PAIR_VAL(p);
	  }
	  // Create temp file name as in create_temp_file_name.
	  buffer_t buf;
	  sprintf(buf, "cco.");
	  char *mapped_name = tempnam (tmpdir, buf);
	  add_string_pair (temp_obj_files, obj_name, mapped_name);
	  return mapped_name;
	}
Ejemplo n.º 3
0
/* get object file corresponding to src file */
char *
get_object_file (char *src)
{
#if defined(_WIN32) || defined(TARG_NVISA)
	/* user is responsible for specifying writable dir,
	 * don't write it behind their back. */
#else
	// bug 2025
	// Create .o files in /tmp in case the src dir is not writable.
	if (!(keep_flag || (ipa == TRUE) || remember_last_phase == P_any_as)) {
	  char *obj_name = change_suffix(src, "o");
	  string_pair_item_t *p;
	  buffer_t buf;
	  char *mapped_name;
	  FOREACH_STRING_PAIR (p, temp_obj_files) {
	    if (strcmp (STRING_PAIR_KEY(p), obj_name) == 0)
	      return STRING_PAIR_VAL(p);
	  }
	  // Create temp file name as in create_temp_file_name.
	  sprintf(buf, "cco.");
	  mapped_name = tempnam (tmpdir, buf);
	  add_string_pair (temp_obj_files, obj_name, mapped_name);
	  return mapped_name;
	}