Skip to content

Commit 14639a4

Browse files
committed
compat-util: pretend that stub setitimer() always succeeds
When 15b52a4 (compat-util: type-check parameters of no-op replacement functions, 2020-08-06) turned a handful of no-op C-preprocessor macros into static inline functions to give the callers a better type checking for their parameters, it forgot to return anything from the stubbed out setitimer() function, even though the function was defined to return an int just like the real thing. Since the original C-preprocessor macro implementation was to just turn the call to the function an empty statement, we know that the existing callers do not check the return value from it, and it does not matter what value we return. But it is safer to pretend that the call succeeded by returning 0 than making it fail by returning -1 and clobbering errno with some value. Reported-by: Randall S. Becker <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15b52a4 commit 14639a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ struct itimerval {
273273

274274
#ifdef NO_SETITIMER
275275
static inline int setitimer(int which, const struct itimerval *value, struct itimerval *newvalue) {
276-
; /* nothing */
276+
return 0; /* pretend success */
277277
}
278278
#endif
279279

0 commit comments

Comments
 (0)