* set_date - Set the file's date and time * @pathname: Path and name of the file to alter * @actime: Date and time to set * @modtime: Date and time to set * * Give a file a particular date and time. * * Return: 0 Success, set the file's date and time * -1 Error, failed to change the file's date and time */
| 47 | * -1 Error, failed to change the file's date and time |
| 48 | */ |
| 49 | int set_date(const char *pathname, time_t actime, time_t modtime) |
| 50 | { |
| 51 | #ifdef HAVE_UTIME |
| 52 | struct utimbuf ut; |
| 53 | if (!pathname) |
| 54 | return -1; |
| 55 | ut.actime = actime; |
| 56 | ut.modtime = modtime; |
| 57 | if (utime(pathname, &ut)) { |
| 58 | log_error("ERROR: Couldn't set the file's date and time for %s\n", pathname); |
| 59 | return -1; |
| 60 | } |
| 61 | #endif |
| 62 | return 0; |
| 63 | } |
no outgoing calls
no test coverage detected