Skip to content

Commit f96e6d1

Browse files
LumioseSilmillert
authored andcommitted
Use the full definition of the emulated function that is missing
1 parent 787a64f commit f96e6d1

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

include/sudo_compat.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ sudo_dso_public ssize_t sudo_getdelim(char ** restrict bufp, size_t * restrict b
347347
# define getdelim(_a, _b, _c, _d) sudo_getdelim((_a), (_b), (_c), (_d))
348348
#elif defined(HAVE_DECL_GETDELIM) && !HAVE_DECL_GETDELIM
349349
/* getdelim present in libc but missing prototype (old gcc fixed includes?) */
350-
ssize_t getdelim(char **bufp, size_t *bufsizep, int delim, FILE *fp);
350+
ssize_t getdelim(char ** restrict bufp, size_t * restrict bufsizep, int delim, FILE * restrict fp);
351351
#endif /* HAVE_GETDELIM */
352352
#ifndef HAVE_GETUSERSHELL
353353
sudo_dso_public char *sudo_getusershell(void);
@@ -366,20 +366,20 @@ void setusershell(void);
366366
void endusershell(void);
367367
#endif /* HAVE_GETUSERSHELL */
368368
#ifndef HAVE_GMTIME_R
369-
sudo_dso_public struct tm *sudo_gmtime_r(const time_t *, struct tm *);
369+
sudo_dso_public struct tm *sudo_gmtime_r(const time_t * restrict, struct tm * restrict);
370370
# undef gmtime_r
371371
# define gmtime_r(_a, _b) sudo_gmtime_r((_a), (_b))
372372
#endif /* HAVE_GMTIME_R */
373373
#ifndef HAVE_LOCALTIME_R
374-
sudo_dso_public struct tm *sudo_localtime_r(const time_t *, struct tm *);
374+
sudo_dso_public struct tm *sudo_localtime_r(const time_t * restrict, struct tm * restrict);
375375
# undef localtime_r
376376
# define localtime_r(_a, _b) sudo_localtime_r((_a), (_b))
377377
#endif /* HAVE_LOCALTIME_R */
378378
#ifndef HAVE_TIMEGM
379379
sudo_dso_public time_t sudo_timegm(struct tm *);
380380
#endif /* HAVE_TIMEGM */
381381
#ifndef HAVE_UTIMENSAT
382-
sudo_dso_public int sudo_utimensat(int fd, const char *file, const struct timespec *times, int flag);
382+
sudo_dso_public int sudo_utimensat(int fd, const char *file, const struct timespec times[2], int flag);
383383
# undef utimensat
384384
# define utimensat(_a, _b, _c, _d) sudo_utimensat((_a), (_b), (_c), (_d))
385385
#endif /* HAVE_UTIMENSAT */
@@ -389,12 +389,12 @@ sudo_dso_public int sudo_fchmodat(int dfd, const char *path, mode_t mode, int fl
389389
# define fchmodat(_a, _b, _c, _d) sudo_fchmodat((_a), (_b), (_c), (_d))
390390
#endif /* HAVE_FCHMODAT */
391391
#ifndef HAVE_FSTATAT
392-
sudo_dso_public int sudo_fstatat(int dfd, const char *path, struct stat *sb, int flag);
392+
sudo_dso_public int sudo_fstatat(int dfd, const char * restrict path, struct stat * restrict sb, int flag);
393393
# undef fstatat
394394
# define fstatat(_a, _b, _c, _d) sudo_fstatat((_a), (_b), (_c), (_d))
395395
#endif /* HAVE_FSTATAT */
396396
#ifndef HAVE_FUTIMENS
397-
sudo_dso_public int sudo_futimens(int fd, const struct timespec *times);
397+
sudo_dso_public int sudo_futimens(int fd, const struct timespec times[2]);
398398
# undef futimens
399399
# define futimens(_a, _b) sudo_futimens((_a), (_b))
400400
#endif /* HAVE_FUTIMENS */
@@ -508,12 +508,12 @@ sudo_dso_public int sudo_str2sig(const char *signame, int *signum);
508508
# define str2sig(_a, _b) sudo_str2sig((_a), (_b))
509509
#endif /* HAVE_STR2SIG */
510510
#if !defined(HAVE_INET_NTOP) && defined(NEED_INET_NTOP)
511-
sudo_dso_public char *sudo_inet_ntop(int af, const void *src, char *dst, socklen_t size);
511+
sudo_dso_public const char *sudo_inet_ntop(int af, const void * restrict src, char * restrict dst, socklen_t size);
512512
# undef inet_ntop
513513
# define inet_ntop(_a, _b, _c, _d) sudo_inet_ntop((_a), (_b), (_c), (_d))
514514
#endif /* HAVE_INET_NTOP */
515515
#ifndef HAVE_INET_PTON
516-
sudo_dso_public int sudo_inet_pton(int af, const char *src, void *dst);
516+
sudo_dso_public int sudo_inet_pton(int af, const char * restrict src, void * restrict dst);
517517
# undef inet_pton
518518
# define inet_pton(_a, _b, _c) sudo_inet_pton((_a), (_b), (_c))
519519
#endif /* HAVE_INET_PTON */

lib/util/fstatat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#ifndef HAVE_FSTATAT
3434
int
35-
sudo_fstatat(int dfd, const char *path, struct stat *sb, int flag)
35+
sudo_fstatat(int dfd, const char * restrict path, struct stat * restrict sb, int flag)
3636
{
3737
int odfd, ret = -1;
3838

lib/util/gmtime_r.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* Still has the normal gmtime() side effects.
3737
*/
3838
struct tm *
39-
sudo_gmtime_r(const time_t *timer, struct tm *result)
39+
sudo_gmtime_r(const time_t * restrict timer, struct tm * restrict result)
4040
{
4141
struct tm *tm;
4242

lib/util/inet_pton.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ inet_pton6(const char *src, u_char *dst)
233233
* Paul Vixie, 1996.
234234
*/
235235
int
236-
sudo_inet_pton(int af, const char *src, void *dst)
236+
sudo_inet_pton(int af, const char * restrict src, void * restrict dst)
237237
{
238238
switch (af) {
239239
case AF_INET:

lib/util/localtime_r.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* Still has the normal localtime() side effects.
3737
*/
3838
struct tm *
39-
sudo_localtime_r(const time_t *timer, struct tm *result)
39+
sudo_localtime_r(const time_t * restrict timer, struct tm * restrict result)
4040
{
4141
struct tm *tm;
4242

lib/util/utimens.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ utimens_ts_to_tv(int fd, const char *file, const struct timespec *ts,
106106
* Emulate futimens() via futimes()
107107
*/
108108
int
109-
sudo_futimens(int fd, const struct timespec *ts)
109+
sudo_futimens(int fd, const struct timespec ts[2])
110110
{
111111
struct timeval tv[2], *times = NULL;
112112

@@ -122,7 +122,7 @@ sudo_futimens(int fd, const struct timespec *ts)
122122
* Emulate futimens() via futime()
123123
*/
124124
int
125-
sudo_futimens(int fd, const struct timespec *ts)
125+
sudo_futimens(int fd, const struct timespec ts[2])
126126
{
127127
struct utimbuf utb, *times = NULL;
128128

@@ -142,7 +142,7 @@ sudo_futimens(int fd, const struct timespec *ts)
142142
* Nothing to do but fail.
143143
*/
144144
int
145-
sudo_futimens(int fd, const struct timespec *ts)
145+
sudo_futimens(int fd, const struct timespec ts[2])
146146
{
147147
errno = ENOSYS;
148148
return -1;
@@ -154,7 +154,7 @@ sudo_futimens(int fd, const struct timespec *ts)
154154
* Emulate utimensat() via utimes()
155155
*/
156156
int
157-
sudo_utimensat(int fd, const char *file, const struct timespec *ts, int flag)
157+
sudo_utimensat(int fd, const char *file, const struct timespec ts[2], int flag)
158158
{
159159
struct timeval tv[2], *times = NULL;
160160

@@ -175,7 +175,7 @@ sudo_utimensat(int fd, const char *file, const struct timespec *ts, int flag)
175175
* Emulate utimensat() via utime()
176176
*/
177177
int
178-
sudo_utimensat(int fd, const char *file, const struct timespec *ts, int flag)
178+
sudo_utimensat(int fd, const char *file, const struct timespec ts[2], int flag)
179179
{
180180
struct utimbuf utb, *times = NULL;
181181

0 commit comments

Comments
 (0)