read_keytab_file(const char *service_key_file)
{
FILE *skf;
- struct stat st;
+ ws_statb64 st;
service_key_t *sk;
unsigned char buf[SERVICE_KEY_SIZE];
int newline_skip = 0, count = 0;
- if (service_key_file != NULL && ws_stat (service_key_file, &st) == 0) {
+ if (service_key_file != NULL && ws_stat64 (service_key_file, &st) == 0) {
/* The service key file contains raw 192-bit (24 byte) 3DES keys.
* There can be zero, one (\n), or two (\r\n) characters between
/* copied from filesystem.c */
static int capture_opts_test_for_fifo(const char *path)
{
- struct stat statb;
+ ws_statb64 statb;
- if (ws_stat(path, &statb) < 0)
+ if (ws_stat64(path, &statb) < 0)
return errno;
if (S_ISFIFO(statb.st_mode))
char *errmsg, int errmsgl)
{
#ifndef _WIN32
- struct stat pipe_stat;
+ ws_statb64 pipe_stat;
struct sockaddr_un sa;
int sel_ret;
int b;
#endif /* _WIN32 */
} else {
#ifndef _WIN32
- if (ws_stat(pipename, &pipe_stat) < 0) {
+ if (ws_stat64(pipename, &pipe_stat) < 0) {
if (errno == ENOENT || errno == ENOTDIR)
ld->cap_pipe_err = PIPNEXIST;
else {
read_keytab_file(const char *service_key_file)
{
FILE *skf;
- struct stat st;
+ ws_statb64 st;
service_key_t *sk;
unsigned char buf[SERVICE_KEY_SIZE];
int newline_skip = 0, count = 0;
- if (service_key_file != NULL && ws_stat (service_key_file, &st) == 0) {
+ if (service_key_file != NULL && ws_stat64 (service_key_file, &st) == 0) {
/* The service key file contains raw 192-bit (24 byte) 3DES keys.
* There can be zero, one (\n), or two (\r\n) characters between
int
test_for_directory(const char *path)
{
- struct stat statb;
+ ws_statb64 statb;
- if (ws_stat(path, &statb) < 0)
+ if (ws_stat64(path, &statb) < 0)
return errno;
if (S_ISDIR(statb.st_mode))
int
test_for_fifo(const char *path)
{
- struct stat statb;
+ ws_statb64 statb;
- if (ws_stat(path, &statb) < 0)
+ if (ws_stat64(path, &statb) < 0)
return errno;
if (S_ISFIFO(statb.st_mode))
char *pf_dir_path_copy, *pf_dir_parent_path;
size_t pf_dir_parent_path_len;
#endif
- struct stat s_buf;
+ ws_statb64 s_buf;
int ret;
if (profilename) {
* If not then create it.
*/
pf_dir_path = get_profiles_dir ();
- if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
+ if (ws_stat64(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
ret = ws_mkdir(pf_dir_path, 0755);
if (ret == -1) {
*pf_dir_path_return = g_strdup(pf_dir_path);
}
pf_dir_path = get_persconffile_dir(profilename);
- if (ws_stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
+ if (ws_stat64(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
#ifdef _WIN32
/*
* Does the parent directory of that directory
pf_dir_parent_path_len = strlen(pf_dir_parent_path);
if (pf_dir_parent_path_len > 0
&& pf_dir_parent_path[pf_dir_parent_path_len - 1] != ':'
- && ws_stat(pf_dir_parent_path, &s_buf) != 0) {
+ && ws_stat64(pf_dir_parent_path, &s_buf) != 0) {
/*
* No, it doesn't exist - make it first.
*/
{
char *path;
#ifdef _WIN32
- struct stat s_buf;
+ ws_statb64 s_buf;
char *old_path;
#endif
if (do_store_persconffiles && from_profile && !g_hash_table_lookup (profile_files, filename)) {
}
#ifdef _WIN32
if (!for_writing) {
- if (ws_stat(path, &s_buf) != 0 && errno == ENOENT) {
+ if (ws_stat64(path, &s_buf) != 0 && errno == ENOENT) {
/*
* OK, it's not in the personal configuration file
* directory; is it in the ".wireshark" subdirectory
old_path = g_strdup_printf(
"%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s",
get_home_dir(), filename);
- if (ws_stat(old_path, &s_buf) == 0) {
+ if (ws_stat64(old_path, &s_buf) == 0) {
/*
* OK, it exists; return it instead.
*/
gboolean
file_exists(const char *fname)
{
- struct stat file_stat;
+ ws_statb64 file_stat;
#ifdef _WIN32
/*
* so this is working, but maybe not quite the way expected. ULFL
*/
file_stat.st_ino = 1; /* this will make things work if an error occured */
- ws_stat(fname, &file_stat);
+ ws_stat64(fname, &file_stat);
if (file_stat.st_ino == 0) {
return TRUE;
} else {
return FALSE;
}
#else
- if (ws_stat(fname, &file_stat) != 0 && errno == ENOENT) {
+ if (ws_stat64(fname, &file_stat) != 0 && errno == ENOENT) {
return FALSE;
} else {
return TRUE;
return FALSE;
}
#else
- struct stat filestat1, filestat2;
+ ws_statb64 filestat1, filestat2;
/*
* Compare st_dev and st_ino.
*/
- if (ws_stat(fname1, &filestat1) == -1)
+ if (ws_stat64(fname1, &filestat1) == -1)
return FALSE; /* can't get info about the first file */
- if (ws_stat(fname2, &filestat2) == -1)
+ if (ws_stat64(fname2, &filestat2) == -1)
return FALSE; /* can't get info about the second file */
return (filestat1.st_dev == filestat2.st_dev &&
filestat1.st_ino == filestat2.st_ino);
/*
* Look for /sys/class/net/{device}/wireless.
*/
- struct stat statb;
+ ws_statb64 statb;
char *wireless_path;
wireless_path = g_strdup_printf("/sys/class/net/%s/wireless", if_info->name);
if (wireless_path != NULL) {
- if (ws_stat(wireless_path, &statb) == 0) {
+ if (ws_stat64(wireless_path, &statb) == 0) {
g_free(wireless_path);
return pixbuf_to_widget(network_wireless_pb_data);
}
gsize uni_start, uni_end;
const glong max = 60;
int err;
- struct stat stat_buf;
+ ws_statb64 stat_buf;
GtkTooltips *tooltips;
* Add file size. We use binary prefixes instead of IEC because that's what
* most OSes use.
*/
- err = ws_stat(filename, &stat_buf);
+ err = ws_stat64(filename, &stat_buf);
if(err == 0) {
if (stat_buf.st_size/1024/1024/1024 > 10) {
g_string_append_printf(str, " (%" G_GINT64_MODIFIER "d GB)", (gint64) (stat_buf.st_size/1024/1024/1024));
raw_pipe_open(const char *pipe_name)
{
#ifndef _WIN32
- struct stat pipe_stat;
+ ws_statb64 pipe_stat;
#else
char *pncopy, *pos;
DWORD err;
#endif /* _WIN32 */
} else {
#ifndef _WIN32
- if (ws_stat(pipe_name, &pipe_stat) < 0) {
+ if (ws_stat64(pipe_name, &pipe_stat) < 0) {
fprintf(stderr, "rawshark: The pipe %s could not be checked: %s\n",
pipe_name, strerror(errno));
return -1;
wtap* wtap_open_offline(const char *filename, int *err, char **err_info,
gboolean do_random)
{
- struct stat statb;
+ ws_statb64 statb;
wtap *wth;
unsigned int i;
gboolean use_stdin = FALSE;
return NULL;
}
} else {
- if (ws_stat(filename, &statb) < 0) {
+ if (ws_stat64(filename, &statb) < 0) {
*err = errno;
return NULL;
}
* Since: 2.6
*/
int
-ws_stdio_stat (const gchar *filename,
- struct stat *buf)
+ws_stdio_stat64 (const gchar *filename,
+ ws_statb64 *buf)
{
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
(!g_path_is_absolute (filename) || len > (size_t) (g_path_skip_root (filename) - filename)))
wfilename[len] = '\0';
- retval = _wstat (wfilename, (struct _stat *) buf);
+ retval = _wstati64 (wfilename, buf);
save_errno = errno;
g_free (wfilename);
#define ws_open ws_stdio_open
#define ws_rename ws_stdio_rename
#define ws_mkdir ws_stdio_mkdir
-#define ws_stat ws_stdio_stat
+#define ws_stat64 ws_stdio_stat64
#define ws_unlink ws_stdio_unlink
#define ws_remove ws_stdio_remove
#define ws_fopen ws_stdio_fopen
/* "Not Windows" or GLib < 2.6: use "old school" functions */
#ifdef _WIN32
-#define ws_open _open
-#define ws_stat _stat
-#define ws_unlink _unlink
+/* Windows, but GLib < 2.6 */
+#define ws_open _open
+#define ws_stat64 _stati64 /* use _stati64 for 64-bit size support */
+#define ws_unlink _unlink
#define ws_mkdir(dir,mode) _mkdir(dir)
-#else
-#define ws_open open
-#define ws_stat stat
-#define ws_unlink unlink
+#else /* _WIN32 */
+/* "Not Windows" */
+#define ws_open open
+#define ws_stat64 stat
+#define ws_unlink unlink
#define ws_mkdir(dir,mode) mkdir(dir,mode)
#endif /* _WIN32 */