mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
misc.c : Introduce ssh_readn()
A call to read() may peform a short read from a local file even when sufficient data is present in the file. ssh_readn() can be used instead of read() to avoid such short reads. Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
33cdc4e3e4
commit
9c8486aafb
@@ -21,6 +21,21 @@
|
||||
#ifndef MISC_H_
|
||||
#define MISC_H_
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
# ifdef _MSC_VER
|
||||
# ifndef _SSIZE_T_DEFINED
|
||||
# undef ssize_t
|
||||
# include <BaseTsd.h>
|
||||
typedef _W64 SSIZE_T ssize_t;
|
||||
# define _SSIZE_T_DEFINED
|
||||
# endif /* _SSIZE_T_DEFINED */
|
||||
# endif /* _MSC_VER */
|
||||
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -103,6 +118,9 @@ int ssh_newline_vis(const char *string, char *buf, size_t buf_len);
|
||||
int ssh_tmpname(char *name);
|
||||
|
||||
char *ssh_strreplace(const char *src, const char *pattern, const char *repl);
|
||||
|
||||
ssize_t ssh_readn(int fd, void *buf, size_t nbytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user