ObjFW  Check-in [77654f44d2]

Overview
Comment:OFFileIRIHandler: Fix undefined behavior
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 77654f44d2fa78bbc5da489539bf5db7abe4f5f89083e6ac3dd3389def17cf4a
User & Date: js on 2023-08-28 18:57:24
Other Links: manifest | tags
Context
2023-08-28
19:03
OFFileManager: More autorelease pools check-in: d97bba05d2 user: js tags: trunk
18:57
OFFileIRIHandler: Fix undefined behavior check-in: 77654f44d2 user: js tags: trunk
15:49
Makefile: Don't build docs twice on `make release` check-in: 17d4c687ff user: js tags: trunk
Changes

Modified src/OFFileIRIHandler.m from [b18e6efaea] to [bf82260f3f].

840
841
842
843
844
845
846
847
848


849
850
851
852
853


854
855
856
857
858
859
860
840
841
842
843
844
845
846


847
848
849
850
851


852
853
854
855
856
857
858
859
860







-
-
+
+



-
-
+
+







#else
	OFTimeInterval lastAccessTime = lastAccessDate.timeIntervalSince1970;
	OFTimeInterval modificationTime =
	    modificationDate.timeIntervalSince1970;
	struct timeval times[2] = {
		{
			.tv_sec = (time_t)lastAccessTime,
			.tv_usec =
			    (int)((lastAccessTime - times[0].tv_sec) * 1000000)
			.tv_usec = (int)((lastAccessTime -
			    (time_t)lastAccessTime) * 1000000)
		},
		{
			.tv_sec = (time_t)modificationTime,
			.tv_usec = (int)((modificationTime - times[1].tv_sec) *
			    1000000)
			.tv_usec = (int)((modificationTime -
			    (time_t)modificationTime) * 1000000)
		},
	};

	if (utimes([path cStringWithEncoding: [OFLocale encoding]], times) != 0)
		@throw [OFSetItemAttributesFailedException
		    exceptionWithIRI: IRI
			  attributes: attributes