aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>1999-12-17 18:44:15 +0000
committerErik Andersen <andersen@codepoet.org>1999-12-17 18:44:15 +0000
commit4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d (patch)
tree1d18bbba8f8a1d78d7ff13e7a87ee2aab165125f
parent6da0ae8183a31d4faab745d534a363c7e66ef864 (diff)
downloadbusybox-w32-4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d.tar.gz
busybox-w32-4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d.tar.bz2
busybox-w32-4d1d0113fd3309aac30b2dd1d443bf7c7d5f0a3d.zip
Reworked the source so it will compile and run under glibc 2.0.7
and linux kernel 2.0.36 (though the dubious reasons why someone would want to do that defy imagination ;) -Erik
-rw-r--r--Changelog4
-rw-r--r--Makefile6
-rw-r--r--archival/gunzip.c4
-rw-r--r--archival/gzip.c4
-rw-r--r--busybox.spec2
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/du.c5
-rw-r--r--coreutils/tail.c1
-rw-r--r--dd.c2
-rw-r--r--du.c5
-rw-r--r--examples/busybox.spec2
-rw-r--r--fbset.c12
-rw-r--r--gunzip.c4
-rw-r--r--gzip.c4
-rw-r--r--init.c7
-rw-r--r--init/init.c7
-rw-r--r--tail.c1
-rw-r--r--util-linux/fbset.c12
-rw-r--r--utility.c8
19 files changed, 71 insertions, 21 deletions
diff --git a/Changelog b/Changelog
index 5bf8a5f72..2d2972c90 100644
--- a/Changelog
+++ b/Changelog
@@ -1,10 +1,12 @@
10.40 10.40
2 * Added the -s option to du -beppu 2 * Added the -s option to du -beppu
3 * Fixed an embarrasing segfault in head -beppu 3 * Fixed an embarrasing segfault in head -beppu
4 * Fixed an bug in syslogd causing it to stop logging after 20 minutes. -erik
4 * New Apps: lsmod, rmmod -erik 5 * New Apps: lsmod, rmmod -erik
5 * New Apps: fbset contributed by Randolph Chung <tausq@debian.org>. 6 * New Apps: fbset contributed by Randolph Chung <tausq@debian.org>.
6 * Fixed an bug in syslogd causing it to stop logging after 20 minutes. -erik
7 * Fixed the embarrasing failure of the -p opition in the logger app. -erik 7 * Fixed the embarrasing failure of the -p opition in the logger app. -erik
8 * Re-worked the whole source tree a bit so it will compile under glibc 2.0.7
9 with the 2.0.x Linux kernel.
8 10
9 -Erik Andersen 11 -Erik Andersen
10 12
diff --git a/Makefile b/Makefile
index 29ee19035..b50c645bc 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
17 17
18 18
19PROG=busybox 19PROG=busybox
20VERSION=0.39 20VERSION=0.40
21BUILDTIME=$(shell date "+%Y%m%d-%H%M") 21BUILDTIME=$(shell date "+%Y%m%d-%H%M")
22 22
23# Comment out the following to make a debuggable build 23# Comment out the following to make a debuggable build
@@ -31,8 +31,8 @@ DOSTATIC=false
31#This will choke on a non-debian system 31#This will choke on a non-debian system
32ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` 32ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
33 33
34GCCMAJVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\1/p"` 34GCCMAJVERSION=$(shell $(CC) --version | sed -n "s/^\([^\.]*\).*/\1/p" )
35GCCMINVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\2/p"` 35GCCMINVERSION=$(shell $(CC) --version | sed -n "s/^[^\.]*\.\([^\.]*\)[\.].*/\1/p" )
36 36
37GCCSUPPORTSOPTSIZE=$(shell \ 37GCCSUPPORTSOPTSIZE=$(shell \
38if ( test $(GCCMAJVERSION) -eq 2 ) ; then \ 38if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
diff --git a/archival/gunzip.c b/archival/gunzip.c
index a809fed68..61391a33f 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -805,7 +805,11 @@ int gunzip_main (int argc, char** argv)
805 } 805 }
806 806
807 /* Open output fille */ 807 /* Open output fille */
808#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
808 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); 809 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
810#else
811 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL);
812#endif
809 if (outFileNum < 0) { 813 if (outFileNum < 0) {
810 perror(ofname); 814 perror(ofname);
811 do_exit(WARNING); 815 do_exit(WARNING);
diff --git a/archival/gzip.c b/archival/gzip.c
index 983f673e1..76df3ad9a 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1877,7 +1877,11 @@ int gzip_main(int argc, char ** argv)
1877 1877
1878 1878
1879 /* Open output fille */ 1879 /* Open output fille */
1880#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
1880 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); 1881 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
1882#else
1883 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL);
1884#endif
1881 if (outFileNum < 0) { 1885 if (outFileNum < 0) {
1882 perror(ofname); 1886 perror(ofname);
1883 do_exit(WARNING); 1887 do_exit(WARNING);
diff --git a/busybox.spec b/busybox.spec
index 5e9df9d0e..a0351a08e 100644
--- a/busybox.spec
+++ b/busybox.spec
@@ -1,5 +1,5 @@
1Name: busybox 1Name: busybox
2Version: 0.39 2Version: 0.40
3Release: 1 3Release: 1
4Group: System/Utilities 4Group: System/Utilities
5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. 5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 90c1004fa..bc01eedbf 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -33,7 +33,7 @@
33#include <stdio.h> 33#include <stdio.h>
34#include <fcntl.h> 34#include <fcntl.h>
35#include <errno.h> 35#include <errno.h>
36#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) 36#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
37#include <inttypes.h> 37#include <inttypes.h>
38#else 38#else
39typedef unsigned long long int uintmax_t; 39typedef unsigned long long int uintmax_t;
diff --git a/coreutils/du.c b/coreutils/du.c
index ed90bc445..ec03afd95 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -44,9 +44,6 @@ static int du_depth = 0;
44static Display *print; 44static Display *print;
45 45
46static void 46static void
47print_null(size_t size, char *filename) { }
48
49static void
50print_normal(size_t size, char *filename) 47print_normal(size_t size, char *filename)
51{ 48{
52 fprintf(stdout, "%-7d %s\n", (size >> 1), filename); 49 fprintf(stdout, "%-7d %s\n", (size >> 1), filename);
@@ -143,4 +140,4 @@ du_main(int argc, char **argv)
143 exit(0); 140 exit(0);
144} 141}
145 142
146/* $Id: du.c,v 1.7 1999/12/16 21:16:47 beppu Exp $ */ 143/* $Id: du.c,v 1.8 1999/12/17 18:44:15 erik Exp $ */
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 7a64c4ca3..697177dc7 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -27,6 +27,7 @@
27#include "internal.h" 27#include "internal.h"
28 28
29#include <stdio.h> 29#include <stdio.h>
30#include <stdarg.h>
30#include <assert.h> 31#include <assert.h>
31#include <errno.h> 32#include <errno.h>
32#include <sys/types.h> 33#include <sys/types.h>
diff --git a/dd.c b/dd.c
index 90c1004fa..bc01eedbf 100644
--- a/dd.c
+++ b/dd.c
@@ -33,7 +33,7 @@
33#include <stdio.h> 33#include <stdio.h>
34#include <fcntl.h> 34#include <fcntl.h>
35#include <errno.h> 35#include <errno.h>
36#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1) 36#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
37#include <inttypes.h> 37#include <inttypes.h>
38#else 38#else
39typedef unsigned long long int uintmax_t; 39typedef unsigned long long int uintmax_t;
diff --git a/du.c b/du.c
index ed90bc445..ec03afd95 100644
--- a/du.c
+++ b/du.c
@@ -44,9 +44,6 @@ static int du_depth = 0;
44static Display *print; 44static Display *print;
45 45
46static void 46static void
47print_null(size_t size, char *filename) { }
48
49static void
50print_normal(size_t size, char *filename) 47print_normal(size_t size, char *filename)
51{ 48{
52 fprintf(stdout, "%-7d %s\n", (size >> 1), filename); 49 fprintf(stdout, "%-7d %s\n", (size >> 1), filename);
@@ -143,4 +140,4 @@ du_main(int argc, char **argv)
143 exit(0); 140 exit(0);
144} 141}
145 142
146/* $Id: du.c,v 1.7 1999/12/16 21:16:47 beppu Exp $ */ 143/* $Id: du.c,v 1.8 1999/12/17 18:44:15 erik Exp $ */
diff --git a/examples/busybox.spec b/examples/busybox.spec
index 5e9df9d0e..a0351a08e 100644
--- a/examples/busybox.spec
+++ b/examples/busybox.spec
@@ -1,5 +1,5 @@
1Name: busybox 1Name: busybox
2Version: 0.39 2Version: 0.40
3Release: 1 3Release: 1
4Group: System/Utilities 4Group: System/Utilities
5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. 5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
diff --git a/fbset.c b/fbset.c
index 3f7e4552a..c29145e51 100644
--- a/fbset.c
+++ b/fbset.c
@@ -32,9 +32,14 @@
32#include <ctype.h> 32#include <ctype.h>
33#include <sys/ioctl.h> 33#include <sys/ioctl.h>
34#include <linux/fb.h> 34#include <linux/fb.h>
35#include <linux/version.h>
35 36
36#define PERROR(ctx) do { perror(ctx); exit(1); } while(0) 37#define PERROR(ctx) do { perror(ctx); exit(1); } while(0)
37 38
39#ifndef KERNEL_VERSION
40#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
41#endif
42
38#define DEFAULTFBDEV "/dev/fb0" 43#define DEFAULTFBDEV "/dev/fb0"
39#define DEFAULTFBMODE "/etc/fb.modes" 44#define DEFAULTFBMODE "/etc/fb.modes"
40 45
@@ -185,10 +190,16 @@ static void showmode(struct fb_var_screeninfo *v)
185#endif 190#endif
186 printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, 191 printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres,
187 v->xres_virtual, v->yres_virtual, v->bits_per_pixel); 192 v->xres_virtual, v->yres_virtual, v->bits_per_pixel);
193#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
188 printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, 194 printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin,
189 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, 195 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len,
190 v->vsync_len); 196 v->vsync_len);
191 printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); 197 printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false"));
198#else
199 printf("\ttimings %lu %lu %lu %lu %lu %lu %lu\n", v->pixclock, v->left_margin,
200 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len,
201 v->vsync_len);
202#endif
192 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, 203 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset,
193 v->green.length, v->green.offset, v->blue.length, v->blue.offset, 204 v->green.length, v->green.offset, v->blue.length, v->blue.offset,
194 v->transp.length, v->transp.offset); 205 v->transp.length, v->transp.offset);
@@ -215,7 +226,6 @@ extern int fbset_main(int argc, char **argv)
215#endif 226#endif
216{ 227{
217 struct fb_var_screeninfo var, varset; 228 struct fb_var_screeninfo var, varset;
218 struct fb_fix_screeninfo fix;
219 int fh, i; 229 int fh, i;
220 char *fbdev = DEFAULTFBDEV; 230 char *fbdev = DEFAULTFBDEV;
221 char *modefile = DEFAULTFBMODE; 231 char *modefile = DEFAULTFBMODE;
diff --git a/gunzip.c b/gunzip.c
index a809fed68..61391a33f 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -805,7 +805,11 @@ int gunzip_main (int argc, char** argv)
805 } 805 }
806 806
807 /* Open output fille */ 807 /* Open output fille */
808#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
808 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); 809 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
810#else
811 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL);
812#endif
809 if (outFileNum < 0) { 813 if (outFileNum < 0) {
810 perror(ofname); 814 perror(ofname);
811 do_exit(WARNING); 815 do_exit(WARNING);
diff --git a/gzip.c b/gzip.c
index 983f673e1..76df3ad9a 100644
--- a/gzip.c
+++ b/gzip.c
@@ -1877,7 +1877,11 @@ int gzip_main(int argc, char ** argv)
1877 1877
1878 1878
1879 /* Open output fille */ 1879 /* Open output fille */
1880#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
1880 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW); 1881 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
1882#else
1883 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL);
1884#endif
1881 if (outFileNum < 0) { 1885 if (outFileNum < 0) {
1882 perror(ofname); 1886 perror(ofname);
1883 do_exit(WARNING); 1887 do_exit(WARNING);
diff --git a/init.c b/init.c
index 5203713ca..ba65f51fd 100644
--- a/init.c
+++ b/init.c
@@ -41,6 +41,7 @@
41#include <linux/serial.h> /* for serial_struct */ 41#include <linux/serial.h> /* for serial_struct */
42#include <sys/vt.h> /* for vt_stat */ 42#include <sys/vt.h> /* for vt_stat */
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <linux/version.h>
44#ifdef BB_SYSLOGD 45#ifdef BB_SYSLOGD
45#include <sys/syslog.h> 46#include <sys/syslog.h>
46#endif 47#endif
@@ -49,6 +50,10 @@
49#error Sorry, I depend on the /proc filesystem right now. 50#error Sorry, I depend on the /proc filesystem right now.
50#endif 51#endif
51 52
53#ifndef KERNEL_VERSION
54#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
55#endif
56
52 57
53#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ 58#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
54#define VT_SECONDARY "/dev/tty2" /* Virtual console */ 59#define VT_SECONDARY "/dev/tty2" /* Virtual console */
@@ -418,9 +423,11 @@ static void halt_signal(int sig)
418 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); 423 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n");
419 sync(); 424 sync();
420#ifndef DEBUG_INIT 425#ifndef DEBUG_INIT
426#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
421 if (sig == SIGUSR2) 427 if (sig == SIGUSR2)
422 reboot(RB_POWER_OFF); 428 reboot(RB_POWER_OFF);
423 else 429 else
430#endif
424 reboot(RB_HALT_SYSTEM); 431 reboot(RB_HALT_SYSTEM);
425#endif 432#endif
426 exit(0); 433 exit(0);
diff --git a/init/init.c b/init/init.c
index 5203713ca..ba65f51fd 100644
--- a/init/init.c
+++ b/init/init.c
@@ -41,6 +41,7 @@
41#include <linux/serial.h> /* for serial_struct */ 41#include <linux/serial.h> /* for serial_struct */
42#include <sys/vt.h> /* for vt_stat */ 42#include <sys/vt.h> /* for vt_stat */
43#include <sys/ioctl.h> 43#include <sys/ioctl.h>
44#include <linux/version.h>
44#ifdef BB_SYSLOGD 45#ifdef BB_SYSLOGD
45#include <sys/syslog.h> 46#include <sys/syslog.h>
46#endif 47#endif
@@ -49,6 +50,10 @@
49#error Sorry, I depend on the /proc filesystem right now. 50#error Sorry, I depend on the /proc filesystem right now.
50#endif 51#endif
51 52
53#ifndef KERNEL_VERSION
54#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
55#endif
56
52 57
53#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ 58#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
54#define VT_SECONDARY "/dev/tty2" /* Virtual console */ 59#define VT_SECONDARY "/dev/tty2" /* Virtual console */
@@ -418,9 +423,11 @@ static void halt_signal(int sig)
418 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n"); 423 "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n");
419 sync(); 424 sync();
420#ifndef DEBUG_INIT 425#ifndef DEBUG_INIT
426#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
421 if (sig == SIGUSR2) 427 if (sig == SIGUSR2)
422 reboot(RB_POWER_OFF); 428 reboot(RB_POWER_OFF);
423 else 429 else
430#endif
424 reboot(RB_HALT_SYSTEM); 431 reboot(RB_HALT_SYSTEM);
425#endif 432#endif
426 exit(0); 433 exit(0);
diff --git a/tail.c b/tail.c
index 7a64c4ca3..697177dc7 100644
--- a/tail.c
+++ b/tail.c
@@ -27,6 +27,7 @@
27#include "internal.h" 27#include "internal.h"
28 28
29#include <stdio.h> 29#include <stdio.h>
30#include <stdarg.h>
30#include <assert.h> 31#include <assert.h>
31#include <errno.h> 32#include <errno.h>
32#include <sys/types.h> 33#include <sys/types.h>
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 3f7e4552a..c29145e51 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -32,9 +32,14 @@
32#include <ctype.h> 32#include <ctype.h>
33#include <sys/ioctl.h> 33#include <sys/ioctl.h>
34#include <linux/fb.h> 34#include <linux/fb.h>
35#include <linux/version.h>
35 36
36#define PERROR(ctx) do { perror(ctx); exit(1); } while(0) 37#define PERROR(ctx) do { perror(ctx); exit(1); } while(0)
37 38
39#ifndef KERNEL_VERSION
40#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
41#endif
42
38#define DEFAULTFBDEV "/dev/fb0" 43#define DEFAULTFBDEV "/dev/fb0"
39#define DEFAULTFBMODE "/etc/fb.modes" 44#define DEFAULTFBMODE "/etc/fb.modes"
40 45
@@ -185,10 +190,16 @@ static void showmode(struct fb_var_screeninfo *v)
185#endif 190#endif
186 printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, 191 printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres,
187 v->xres_virtual, v->yres_virtual, v->bits_per_pixel); 192 v->xres_virtual, v->yres_virtual, v->bits_per_pixel);
193#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
188 printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, 194 printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin,
189 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, 195 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len,
190 v->vsync_len); 196 v->vsync_len);
191 printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); 197 printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false"));
198#else
199 printf("\ttimings %lu %lu %lu %lu %lu %lu %lu\n", v->pixclock, v->left_margin,
200 v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len,
201 v->vsync_len);
202#endif
192 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, 203 printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset,
193 v->green.length, v->green.offset, v->blue.length, v->blue.offset, 204 v->green.length, v->green.offset, v->blue.length, v->blue.offset,
194 v->transp.length, v->transp.offset); 205 v->transp.length, v->transp.offset);
@@ -215,7 +226,6 @@ extern int fbset_main(int argc, char **argv)
215#endif 226#endif
216{ 227{
217 struct fb_var_screeninfo var, varset; 228 struct fb_var_screeninfo var, varset;
218 struct fb_fix_screeninfo fix;
219 int fh, i; 229 int fh, i;
220 char *fbdev = DEFAULTFBDEV; 230 char *fbdev = DEFAULTFBDEV;
221 char *modefile = DEFAULTFBMODE; 231 char *modefile = DEFAULTFBMODE;
diff --git a/utility.c b/utility.c
index 74df632b9..e5c177ad5 100644
--- a/utility.c
+++ b/utility.c
@@ -217,10 +217,12 @@ copyFile( const char *srcName, const char *destName,
217 if (setModes == TRUE) { 217 if (setModes == TRUE) {
218 //fprintf(stderr, "Setting permissions for %s\n", destName); 218 //fprintf(stderr, "Setting permissions for %s\n", destName);
219 chmod(destName, srcStatBuf.st_mode); 219 chmod(destName, srcStatBuf.st_mode);
220 if (followLinks == TRUE) 220#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
221 chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); 221 if (followLinks == FALSE)
222 else
223 lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); 222 lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
223 else
224#endif
225 chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
224 226
225 times.actime = srcStatBuf.st_atime; 227 times.actime = srcStatBuf.st_atime;
226 times.modtime = srcStatBuf.st_mtime; 228 times.modtime = srcStatBuf.st_mtime;