[PATCH] Fix a bug of utime

Jie Zhang jzhang918 at gmail.com
Tue Jan 23 14:38:18 UTC 2007


For some ports of linux kernel, like Blackfin, __NR_utime is not
defined. For such ports, instead of doing a system call, uCllibc
provides utime (), which in return calls utimes (). The current
implement of this utime () in uClibc is not correct when the second
argument is NULL. The following is from the utime manpage:

       int utime(const char *filename, const struct utimbuf *buf);

       If  buf is NULL, then the access and modification times of the file are
       set to the current time.

       Changing time stamps is permitted when: either the process  has  appro‐
       priate privileges (Linux: has the CAP_FOWNER capability), or the effec‐
       tive user ID equals the user ID of the file, or buf must  is  NULL  and
       the process has write permission to the file.

The current implement of the utime () passes the address of a buffer,
which is filled with the current time, to utimes () if its second
argument is NULL. But then the kernel cannot see the NULL and changing
time stamps will not be permitted even the process has write
permission to the file. With this patch, utime () directly pass NULL
to utimes ().

Is it OK? If it's OK, please add Jane Lv as the co-author of the patch
when committing.

Thanks,
Jie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uclibc-utime.diff
Type: text/x-patch
Size: 593 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20070123/79ac456f/attachment-0002.bin 


More information about the uClibc mailing list