Changeset 27060
- Timestamp:
- Feb 24, 2010, 2:09:10 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfig.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfig.c
r26636 r27060 42 42 #define DEFAULT_LOG STDERR_FILENO // Default file descriptor for log messages 43 43 #define DEFAULT_TRACE STDERR_FILENO // Default file descriptor for trace messages 44 45 #define CHECK_FILE_RETRY 5 // Number of retries when checking a file 46 #define CHECK_FILE_WAIT 250000 // Wait between retries (usec) when checking a file 44 47 45 48 static bool readCameraConfig = true; // Read the camera config on startup (with pmConfigRead)? … … 552 555 psString resolved = pmConfigConvertFilename(logDest, config, true, false); // Resolved filename 553 556 if (!resolved || strlen(resolved) == 0) { 554 psWarning("Unable to resolve log destination: %s --- ignored", logDest); 555 } else { 556 pmConfigRunFilenameAddWrite(config, "LOG", logDest); 557 config->logFD = psMessageDestination(resolved); 558 } 557 psError(psErrorCodeLast(), false, "Unable to resolve log destination: %s", logDest); 558 psFree(logDest); 559 return NULL; 560 } 561 pmConfigRunFilenameAddWrite(config, "LOG", logDest); 562 config->logFD = psMessageDestination(resolved); 559 563 psFree(resolved); 560 564 psFree(logDest); … … 611 615 psString resolved = pmConfigConvertFilename(traceDest, config, true, false); // Resolved filename 612 616 if (!resolved || strlen(resolved) == 0) { 613 psWarning("Unable to resolve trace destination: %s --- ignored", traceDest); 614 } else { 615 pmConfigRunFilenameAddWrite(config, "TRACE", traceDest); 616 config->traceFD = psMessageDestination(resolved); 617 } 617 psError(psErrorCodeLast(), false, "Unable to resolve trace destination: %s", traceDest); 618 psFree(traceDest); 619 return NULL; 620 } 621 pmConfigRunFilenameAddWrite(config, "TRACE", traceDest); 622 config->traceFD = psMessageDestination(resolved); 618 623 psFree(resolved); 619 624 psFree(traceDest); … … 1591 1596 1592 1597 char *point = newName + strlen("file:"); 1593 while (*point == '/') 1598 while (*point == '/') { 1594 1599 point ++; 1600 } 1595 1601 char *tmpName = NULL; 1596 1602 psStringAppend (&tmpName, "/%s", point); … … 1600 1606 if (!checkPath(newName, create, trunc)) { 1601 1607 // let checkPath()'s psError() call float up 1602 psError( PS_ERR_UNKNOWN, false, "error from checkPath for file:// (%s)", newName);1608 psError(psErrorCodeLast(), false, "error from checkPath for file:// (%s)", newName); 1603 1609 psFree (newName); 1604 1610 return NULL; … … 1712 1718 nebServerFree(server); 1713 1719 1714 if (trunc) { 1715 if(truncate(path, 0) != 0) { 1716 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", 1717 filename, path); 1718 return NULL; 1719 } 1720 // Check to ensure it's there. Never create, because Nebulous has done that for us. 1721 if (!checkPath(path, false, trunc)) { 1722 psError(psErrorCodeLast(), false, "Cannot find file %s", path); 1723 psFree(path); 1724 return NULL; 1720 1725 } 1721 1726 … … 1802 1807 1803 1808 // re-try access up to 5 times (1.25sec) to reduce NFS lurches 1804 for (int i = 0; i < 5; i++) {1809 for (int i = 0; i < CHECK_FILE_RETRY; i++) { 1805 1810 if (access(filename, R_OK) == 0) { 1806 1811 // file already exists … … 1827 1832 return true; 1828 1833 } 1829 usleep (250000);1834 usleep(CHECK_FILE_WAIT); 1830 1835 } 1831 1836
Note:
See TracChangeset
for help on using the changeset viewer.
