Skip to content

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Apr 25, 2023

Simplify the way we handle gettimeofday() fallback for platforms
without native support or without any support. Make it similar to
how we handle snprintf().

In case of no native gettimeofday() support and a non-Windows
platform, our local fallback returns zero in tv_usec and tv_sec,
ending up with a zero timeout_remaining in session.c, same as
before this patch.

Also:

  • drop unused sys/time.h headers.
  • fix our fallback code to compile with any Windows compilers
    (not just MSVC)
  • delete unnecessary casts.

Closes #1001


@vszakats vszakats changed the title tidy-up: gettimeofday() override and use tidy-up: gettimeofday() override and use Apr 25, 2023
Make it similar to how we handle `snprintf()`.

Drop unused `sys/time.h` headers.
@vszakats vszakats force-pushed the simplify-gettimeofday branch from b49d2b1 to f89af02 Compare April 25, 2023 18:35
@vszakats vszakats changed the title tidy-up: gettimeofday() override and use tidy-up: gettimeofday() fallback and use Apr 25, 2023
@vszakats vszakats closed this in e53aae0 Apr 26, 2023
@vszakats vszakats deleted the simplify-gettimeofday branch April 26, 2023 00:53
vszakats added a commit that referenced this pull request Mar 29, 2024
In AIX, `time.h` header file doesn't have definitions like
`fd_set`, `struct timeval`, which are found in `sys/time.h`.

Add `sys/time.h` to files affected when available.

Regression from e53aae0 #1001.

Reported-by: shubhamhii on GitHub
Assisted-by: shubhamhii on GitHub
Fixes #1334
Fixes #1335
Closes #1340
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Simplify the way we handle `gettimeofday()` fallback for platforms
without native support or without any support. Make it similar to
how we handle `snprintf()`.

In case of no native `gettimeofday()` support and a non-Windows
platform, our local fallback returns zero in `tv_usec` and `tv_sec`,
ending up with a zero `timeout_remaining` in `session.c`, same as
before this patch.

Also:
- drop unused `sys/time.h` headers.
- fix our fallback code to compile with any Windows compilers
  (not just MSVC)
- delete unnecessary casts.

Closes libssh2#1001
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
In AIX, `time.h` header file doesn't have definitions like
`fd_set`, `struct timeval`, which are found in `sys/time.h`.

Add `sys/time.h` to files affected when available.

Regression from e53aae0 libssh2#1001.

Reported-by: shubhamhii on GitHub
Assisted-by: shubhamhii on GitHub
Fixes libssh2#1334
Fixes libssh2#1335
Closes libssh2#1340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant