Bug 8053 - Older C compilers don't allow in-line declarations flist.c:1653
Summary: Older C compilers don't allow in-line declarations flist.c:1653
Status: RESOLVED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All FreeBSD
: P5 minor (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
: 8073 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-01 17:35 UTC by KS Braunsdorf
Modified: 2011-04-10 22:15 UTC (History)
1 user (show)

See Also:


Attachments
Move the var declaration up (588 bytes, patch)
2011-04-10 22:11 UTC, Wayne Davison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description KS Braunsdorf 2011-04-01 17:35:28 UTC
The build for rsync fails on FreeBSD with older gcc versions due to
a syntax error.  This

A pure C compiler doesn't allow C++ style in-line declarations, we need
a curly brace to scope the declaration of name_len here:

--- flist.c     Mon Feb 21 12:20:58 2011
+++ ../flist.c  Fri Apr  1 12:33:18 2011
@@ -1651,4 +1651,5 @@
                    || (dname[1] == '.' && dname[2] == '\0')))
                        continue;
+               {
                unsigned name_len = strlcpy(p, dname, remainder);
                if (name_len >= remainder) {
@@ -1671,4 +1672,5 @@

                send_file_name(f, flist, fbuf, NULL, flags, filter_level);
+               }
        }
Comment 1 Wayne Davison 2011-04-10 22:11:30 UTC
Created attachment 6397 [details]
Move the var declaration up
Comment 2 Wayne Davison 2011-04-10 22:12:32 UTC
I checked-in a fix for this a little while ago on the git master branch.  Attached is a patch for 3.0.8.
Comment 3 Wayne Davison 2011-04-10 22:15:35 UTC
*** Bug 8073 has been marked as a duplicate of this bug. ***