From: "RĂ©mi Bernon" Subject: [RFC PATCH 2/5] wineboot: Move .update-timestamp to drive_c/.wine. Message-Id: <20200330122430.2945061-3-rbernon@codeweavers.com> Date: Mon, 30 Mar 2020 14:24:27 +0200 In-Reply-To: <20200330122430.2945061-1-rbernon@codeweavers.com> References: <20200330122430.2945061-1-rbernon@codeweavers.com> When mounting an overlayfs to drive_c in the next patch, we need to expose the lower layer timestamp to wineboot, so it doesn't update the upper layer every time. --- programs/wineboot/wineboot.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index e1dbe6630221..913c967d4d4d 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -118,17 +118,12 @@ static WCHAR *get_wine_inf_path(void) /* update the timestamp if different from the reference time */ static BOOL update_timestamp( const WCHAR *config_dir, unsigned long timestamp ) { - static const WCHAR timestampW[] = {'\\','.','u','p','d','a','t','e','-','t','i','m','e','s','t','a','m','p',0}; + static const WCHAR timestampW[] = {'C',':','\\','.','w','i','n','e','\\','u','p','d','a','t','e','-','t','i','m','e','s','t','a','m','p',0}; BOOL ret = FALSE; int fd, count; char buffer[100]; - WCHAR *file = HeapAlloc( GetProcessHeap(), 0, lstrlenW(config_dir) * sizeof(WCHAR) + sizeof(timestampW) ); - if (!file) return FALSE; - lstrcpyW( file, config_dir ); - lstrcatW( file, timestampW ); - - if ((fd = _wopen( file, O_RDWR )) != -1) + if ((fd = _wopen( timestampW, O_RDWR )) != -1) { if ((count = read( fd, buffer, sizeof(buffer) - 1 )) >= 0) { @@ -142,20 +137,19 @@ static BOOL update_timestamp( const WCHAR *config_dir, unsigned long timestamp ) else { if (errno != ENOENT) goto done; - if ((fd = _wopen( file, O_WRONLY | O_CREAT | O_TRUNC, 0666 )) == -1) goto done; + if ((fd = _wopen( timestampW, O_WRONLY | O_CREAT | O_TRUNC, 0666 )) == -1) goto done; } count = sprintf( buffer, "%lu\n", timestamp ); if (write( fd, buffer, count ) != count) { - WINE_WARN( "failed to update timestamp in %s\n", debugstr_w(file) ); + WINE_WARN( "failed to update timestamp in %s\n", debugstr_w(timestampW) ); chsize( fd, 0 ); } else ret = TRUE; done: if (fd != -1) close( fd ); - HeapFree( GetProcessHeap(), 0, file ); return ret; } -- 2.26.0.rc2