Skip to content

Fix implicit declaration of utimes and gettimeofday.

gnome-keyring 3.36.0 doesn't build (on macOS 10.15.7 with Xcode 12.4):

pkcs11/xdg-store/mock-xdg-module.c:91:2: error: implicit declaration of function 'gettimeofday' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        gettimeofday (tv, NULL);
pkcs11/xdg-store/mock-xdg-module.c:95:6: error: implicit declaration of function 'utimes' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        if (utimes (filename, tv) < 0)
pkcs11/xdg-store/mock-xdg-module.c:95:6: note: did you mean 'times'?
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/times.h:90:9: note: 'times' declared here
clock_t times(struct tms *);
2 errors generated.

This was reported to MacPorts here:

Although I realize newer versions of gnome-keyring are available and I have not tested them, this source code file doesn't look like it has been touched in 8 years so I don't believe you've fixed the problem yet. This PR fixes the problem for me on macOS.

It seems like there was just a typo where sys/times.h should have been sys/time.h so that's what I changed. It's possible that on systems other than mine something this file uses is actually declared in sys/times.h and that both headers should be there.

Merge request reports