| 1459 | */ |
| 1460 | |
| 1461 | static const char * // O - Path or NULL on error |
| 1462 | http_default_path( |
| 1463 | char *buffer, // I - Path buffer |
| 1464 | size_t bufsize) // I - Size of path buffer |
| 1465 | { |
| 1466 | _cups_globals_t *cg = _cupsGlobals(); |
| 1467 | // Pointer to library globals |
| 1468 | |
| 1469 | |
| 1470 | #ifdef _WIN32 |
| 1471 | if (cg->home) |
| 1472 | #else |
| 1473 | if (cg->home && getuid()) |
| 1474 | #endif // _WIN32 |
| 1475 | { |
| 1476 | snprintf(buffer, bufsize, "%s/.cups", cg->home); |
| 1477 | if (access(buffer, 0)) |
| 1478 | { |
| 1479 | DEBUG_printf(("1http_default_path: Making directory \"%s\".", buffer)); |
| 1480 | if (mkdir(buffer, 0700)) |
| 1481 | { |
| 1482 | DEBUG_printf(("1http_default_path: Failed to make directory: %s", strerror(errno))); |
| 1483 | return (NULL); |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | snprintf(buffer, bufsize, "%s/.cups/ssl", cg->home); |
| 1488 | if (access(buffer, 0)) |
| 1489 | { |
| 1490 | DEBUG_printf(("1http_default_path: Making directory \"%s\".", buffer)); |
| 1491 | if (mkdir(buffer, 0700)) |
| 1492 | { |
| 1493 | DEBUG_printf(("1http_default_path: Failed to make directory: %s", strerror(errno))); |
| 1494 | return (NULL); |
| 1495 | } |
| 1496 | } |
| 1497 | } |
| 1498 | else |
| 1499 | strlcpy(buffer, CUPS_SERVERROOT "/ssl", bufsize); |
| 1500 | |
| 1501 | DEBUG_printf(("1http_default_path: Using default path \"%s\".", buffer)); |
| 1502 | |
| 1503 | return (buffer); |
| 1504 | } |
| 1505 | |
| 1506 | |
| 1507 | // |
no test coverage detected