nginx-0.7.20
Igor Sysoev
is at rambler-co.ru
Tue Nov 11 19:37:34 MSK 2008
On Tue, Nov 11, 2008 at 05:19:36PM +0100, Thomas wrote:
> Compiling on Osx Tiger 10.4.11 with PowerPC G4 cpu and Xcode 2.5
> works, however when I launch Nginx, I get the following error message:
>
> [alert] 10428#0: sysctlbyname(kern.ostype) failed (2: No such file or directory)
>
> That this means that Nginx is no longer compatible with a platform
> similar to mine? Is it a problem concerning my cpu or the operating
> system (or both?)
Could you test the attached patch ?
--
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/os/unix/ngx_darwin_init.c
===================================================================
--- src/os/unix/ngx_darwin_init.c (revision 1621)
+++ src/os/unix/ngx_darwin_init.c (working copy)
@@ -64,32 +64,44 @@
ngx_uint_t i;
size = sizeof(ngx_darwin_kern_ostype);
- if (sysctlbyname("kern.ostype",
- ngx_darwin_kern_ostype, &size, NULL, 0) == -1) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ if (sysctlbyname("kern.ostype", ngx_darwin_kern_ostype, &size, NULL, 0)
+ == -1)
+ {
+ err = ngx_errno;
+
+ ngx_log_error(NGX_LOG_ALERT, log, err,
"sysctlbyname(kern.ostype) failed");
- if (ngx_errno != NGX_ENOMEM) {
- return NGX_ERROR;
+ if (err != NGX_NOENT) {
+
+ if (err != NGX_ENOMEM) {
+ return NGX_ERROR;
+ }
+
+ ngx_darwin_kern_ostype[size - 1] = '\0';
}
-
- ngx_darwin_kern_ostype[size - 1] = '\0';
}
size = sizeof(ngx_darwin_kern_osrelease);
- if (sysctlbyname("kern.osrelease",
- ngx_darwin_kern_osrelease, &size, NULL, 0) == -1) {
- ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+ if (sysctlbyname("kern.osrelease", ngx_darwin_kern_osrelease, &size,
+ NULL, 0)
+ == -1)
+ {
+ err = ngx_errno;
+
+ ngx_log_error(NGX_LOG_ALERT, log, err,
"sysctlbyname(kern.osrelease) failed");
- if (ngx_errno != NGX_ENOMEM) {
- return NGX_ERROR;
+ if (err != NGX_NOENT) {
+
+ if (err != NGX_ENOMEM) {
+ return NGX_ERROR;
+ }
+
+ ngx_darwin_kern_osrelease[size - 1] = '\0';
}
-
- ngx_darwin_kern_osrelease[size - 1] = '\0';
}
-
for (i = 0; sysctls[i].name; i++) {
size = sysctls[i].size;
@@ -136,8 +148,10 @@
u_long value;
ngx_uint_t i;
- ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
- ngx_darwin_kern_ostype, ngx_darwin_kern_osrelease);
+ if (ngx_darwin_kern_ostype[0]) {
+ ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
+ ngx_darwin_kern_ostype, ngx_darwin_kern_osrelease);
+ }
for (i = 0; sysctls[i].name; i++) {
if (sysctls[i].exists) {
More information about the nginx
mailing list