diff --git a/dumpcap.c b/dumpcap.c index e66f71d4dc..a3ee3fec7d 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -266,7 +266,7 @@ static loop_data global_ld; * fixed in 10.6.2. */ #if defined(__APPLE__) && defined(__LP64__) -static int need_timeout_workaround; +static gboolean need_timeout_workaround; #define CAP_READ_TIMEOUT (need_timeout_workaround ? 1000 : 250) #else @@ -2721,18 +2721,28 @@ main(int argc, char *argv[]) #if defined(__APPLE__) && defined(__LP64__) /* - * Is this Mac OS X 10.6 or 10.6.1? If so, we need a bug workaround. + * Is this Mac OS X 10.6.x, other than 10.6.2? If so, we need a bug + * workaround - timeouts less than 1 second don't work with libpcap + * in 64-bit code. (The bug was introduced in 10.6, fixed in 10.6.2, + * and re-introduced in 10.6.3. We don't know whether it'll be fixed + * again in a later 10.6.x release; we'll assume that it'll be fixed + * in any future major releases.) */ if (uname(&osinfo) == 0) { /* - * Mac OS X 10.x uses Darwin x.0.0. Mac OS X 10.x.y uses Darwin - * x.y.0 (except that 10.6.1 appears to have a uname version + * Mac OS X 10.x uses Darwin {x+4}.0.0. Mac OS X 10.x.y uses Darwin + * {x+4}.y.0 (except that 10.6.1 appears to have a uname version * number of 10.0.0, not 10.1.0 - go figure). */ - if (strcmp(osinfo.release, "10.0.0") == 0 || - strcmp(osinfo.release, "10.1.0") == 0 || - strcmp(osinfo.release, "10.3.0") == 0) - need_timeout_workaround = 1; + if (strncmp(osinfo.release, "10.", 3) == 0) { + /* + * OK, it's Snow Leopard - which version? + */ + if (strcmp(osinfo.release, "10.2.0") != 0) { + /* Not 10.6.2. */ + need_timeout_workaround = TRUE; + } + } } #endif