Fix compiler errors on FreeBSD.

Fixes #93.
This commit is contained in:
Ben Noordhuis 2011-07-11 02:40:39 +02:00
parent 8d3d4a4244
commit 33b1b7acb9

View File

@ -20,25 +20,29 @@
#include "uv.h"
#include <string.h>
#include <sys/types.h>
#include <sys/sysctl.h>
int uv_exepath(char* buffer, size_t* size) {
uint32_t usize;
int result;
char* path;
char* fullpath;
int mib[4];
size_t cb;
if (!buffer || !size) {
return -1;
}
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
size_t cb = *size;
cb = *size;
if (sysctl(mib, 4, buffer, &cb, NULL, 0) < 0) {
*size = 0;
return -1;