some non-gnu compilers can't have non-const struct initializers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a307af1af6
commit
389cca4b9e
@ -105,10 +105,12 @@ int FAST_FUNC bbunpack(char **argv,
|
|||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
/* TODO: restore other things? */
|
/* TODO: restore other things? */
|
||||||
if (info.mtime) {
|
if (info.mtime) {
|
||||||
struct timeval times = {.tv_sec = info.mtime,
|
struct timeval times;
|
||||||
.tv_usec = 0};
|
|
||||||
|
times.tv_sec = info.mtime;
|
||||||
|
times.tv_usec = 0;
|
||||||
/* Note: we closed it first.
|
/* Note: we closed it first.
|
||||||
* On some systems calling utime
|
* On some systems calling utimes
|
||||||
* then closing resets the mtime
|
* then closing resets the mtime
|
||||||
* back to current time. */
|
* back to current time. */
|
||||||
utimes(new_name, ×); /* ignoring errors */
|
utimes(new_name, ×); /* ignoring errors */
|
||||||
|
@ -143,8 +143,10 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
|
|||||||
}
|
}
|
||||||
/* same for utime */
|
/* same for utime */
|
||||||
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
|
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
|
||||||
struct timeval t = {.tv_sec = file_header->mtime,
|
struct timeval t;
|
||||||
.tv_usec = 0};
|
|
||||||
|
t.tv_sec = file_header->mtime;
|
||||||
|
t.tv_usec = 0;
|
||||||
utimes(file_header->name, &t);
|
utimes(file_header->name, &t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int touch_main(int argc UNUSED_PARAM, char **argv)
|
int touch_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
int status = EXIT_SUCCESS;
|
||||||
|
int opts;
|
||||||
#if ENABLE_DESKTOP
|
#if ENABLE_DESKTOP
|
||||||
# if ENABLE_LONG_OPTS
|
# if ENABLE_LONG_OPTS
|
||||||
static const char touch_longopts[] ALIGN1 =
|
static const char touch_longopts[] ALIGN1 =
|
||||||
@ -49,17 +52,15 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
"date\0" Required_argument "d"
|
"date\0" Required_argument "d"
|
||||||
;
|
;
|
||||||
# endif
|
# endif
|
||||||
struct timeval timebuf = {.tv_usec = 0};
|
|
||||||
char *reference_file = NULL;
|
char *reference_file = NULL;
|
||||||
char *date_str = NULL;
|
char *date_str = NULL;
|
||||||
|
struct timeval timebuf;
|
||||||
|
timebuf.tv_usec = 0;
|
||||||
#else
|
#else
|
||||||
# define reference_file NULL
|
# define reference_file NULL
|
||||||
# define date_str NULL
|
# define date_str NULL
|
||||||
# define timebuf (*(struct timeval*)NULL)
|
# define timebuf (*(struct timeval*)NULL)
|
||||||
#endif
|
#endif
|
||||||
int fd;
|
|
||||||
int status = EXIT_SUCCESS;
|
|
||||||
int opts;
|
|
||||||
|
|
||||||
#if ENABLE_DESKTOP && ENABLE_LONG_OPTS
|
#if ENABLE_DESKTOP && ENABLE_LONG_OPTS
|
||||||
applet_long_options = touch_longopts;
|
applet_long_options = touch_longopts;
|
||||||
|
@ -374,8 +374,10 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
|
|||||||
/* Cannot happen: */
|
/* Cannot happen: */
|
||||||
/* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
|
/* && !(flags & (FILEUTILS_MAKE_SOFTLINK|FILEUTILS_MAKE_HARDLINK)) */
|
||||||
) {
|
) {
|
||||||
struct timeval times = {.tv_sec = source_stat.st_mtime,
|
struct timeval times;
|
||||||
.tv_usec = 0};
|
|
||||||
|
times.tv_sec = source_stat.st_mtime;
|
||||||
|
times.tv_usec = 0;
|
||||||
/* BTW, utimes sets usec-precision time - just FYI */
|
/* BTW, utimes sets usec-precision time - just FYI */
|
||||||
if (utimes(dest, ×) < 0)
|
if (utimes(dest, ×) < 0)
|
||||||
bb_perror_msg("can't preserve %s of '%s'", "times", dest);
|
bb_perror_msg("can't preserve %s of '%s'", "times", dest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user