Changeset 2ce23a3 in rtems-tools
- Timestamp:
- 08/01/14 06:47:11 (8 years ago)
- Branches:
- 4.10, 4.11, 5, master
- Children:
- ea29902
- Parents:
- 427acf3
- Location:
- linkers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
linkers/rld-files.cpp
r427acf3 r2ce23a3 26 26 #include <string.h> 27 27 #include <sys/stat.h> 28 #include <unistd.h> 28 29 29 30 #include <rld.h> -
linkers/rld-outputter.cpp
r427acf3 r2ce23a3 45 45 namespace outputter 46 46 { 47 int unlink (const char* path) 48 { 49 #if _WIN32 50 return ::remove(path); 51 #else 52 return ::unlink (path); 53 #endif 54 } 55 56 int link (const char* path1, const char* path2) 57 { 58 #if _WIN32 59 return ::rename(path1, path2); 60 #else 61 return ::link (path1, path2); 62 #endif 63 } 64 47 65 const std::string 48 66 script_text (const std::string& entry, … … 260 278 if (ra_exist) 261 279 { 262 std::string new_name = "rld_XXXXXX"; 263 struct stat sb; 280 std::string new_name = "rld_XXXXXX"; 264 281 files::archive arch (new_name); 282 struct stat sb; 283 265 284 arch.create (objects); 266 285 267 286 if ((::stat (name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode)) 268 287 { 269 if ( ::unlink (name.c_str ()) < 0)288 if (unlink (name.c_str ()) < 0) 270 289 std::cerr << "error: unlinking temp file: " << name << std::endl; 271 290 } 272 if ( ::link (new_name.c_str (), name.c_str ()) < 0)291 if (link (new_name.c_str (), name.c_str ()) < 0) 273 292 { 274 293 std::cerr << "error: linking temp file: " << name << std::endl; … … 276 295 if ((::stat (new_name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode)) 277 296 { 278 if ( ::unlink (new_name.c_str ()) < 0)297 if (unlink (new_name.c_str ()) < 0) 279 298 std::cerr << "error: unlinking temp file: " << new_name << std::endl; 280 299 } -
linkers/rld-process.cpp
r427acf3 r2ce23a3 1 1 /* 2 * Copyright (c) 2011, Chris Johns <chrisj@rtems.org> 2 * Copyright (c) 2011, Chris Johns <chrisj@rtems.org> 3 3 * 4 4 * Permission to use, copy, modify, and/or distribute this software for any 5 5 * purpose with or without fee is hereby granted, provided that the above 6 6 * copyright notice and this permission notice appear in all copies. 7 * 7 * 8 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF … … 24 24 #include <string.h> 25 25 #include <sys/stat.h> 26 #include <unistd.h> 26 27 27 28 #ifdef HAVE_SYS_WAIT_H … … 67 68 clean_up (); 68 69 } 69 70 70 71 const std::string 71 72 temporary_files::get () … … 89 90 if ((::stat (name.c_str (), &sb) >= 0) && S_ISREG (sb.st_mode)) 90 91 { 91 if (::unlink (name.c_str ()) < 0) 92 int r; 93 #if _WIN32 94 r = ::remove(name.c_str ()); 95 #else 96 r = ::unlink (name.c_str ()); 97 #endif 98 if (r < 0) 92 99 { 93 100 std::cerr << "error: unlinking temp file: " << name << std::endl; … … 160 167 } 161 168 162 const std::string& 169 const std::string& 163 170 tempfile::name () const 164 171 { … … 175 182 if (::stat (_name.c_str (), &sb) == 0) 176 183 return sb.st_size; 177 184 178 185 return 0; 179 186 } … … 243 250 244 251 void 245 tempfile::output (const std::string& prefix, 252 tempfile::output (const std::string& prefix, 246 253 std::ostream& out, 247 254 bool line_numbers) … … 269 276 270 277 status 271 execute (const std::string& pname, 278 execute (const std::string& pname, 272 279 const std::string& command, 273 280 const std::string& outname, … … 280 287 281 288 status 282 execute (const std::string& pname, 289 execute (const std::string& pname, 283 290 const arg_container& args, 284 291 const std::string& outname, … … 346 353 else 347 354 throw rld::error ("execute: " + args[0], "unknown status returned"); 348 355 349 356 return _status; 350 357 } … … 365 372 366 373 args.clear (); 367 374 368 375 const char quote = '"'; 369 376 const char escape = '\\';
Note: See TracChangeset
for help on using the changeset viewer.