embutils sendfile, return statements

Georg Sauthoff <[email protected]>
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

looked at mv.c from embutils 0.19 and noticed that the large file check
for sendfile misses a >= operator. Thought, that for 64-bit embedded
systems the large file limit for sendfile should be different:

-    if (ss.st_size>(1ul<<31) || !S_ISREG(ss.st_mode)) {        /* large file */
+    if (ss.st_size>=(1ul<<(sizeof(ssize_t)*8-1))
+        || !S_ISREG(ss.st_mode)) {     /* large file */

Then I noticed, that sendfile does not support file-to-file copying
anymore (sendfile(2)):

       Presently  (Linux  2.6.9): in_fd, must correspond to a file which supports
       mmap(2)-like operations (i.e., it cannot be a  socket);  and  out_fd  must
       refer to a socket.

Thus, you could delete the sendfile stuff and safe 'some' bytes :)

    text           data     bss     dec     hex filename
-   6015             12     344    6371    18e3 bin-x86_64/mv
+   5931             12     344    6287    188f bin-x86_64/mv

About return status of functions:

I noticed that functions like __write1() from write12.h are declared
returning int, but don't include a return statement.  Or in the main
function of touch.c there is only one exit(1) call (no return), which is
only called in case option '-r' is used and an error ocurrs. Or
mount_all() from mount.c does not return a proper status, if opening
fstab fails. etc.

Is this style some crazy optimization or are these issues just
oversights?

Best regards
Georg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.