Print strerror when a system error occurs; add a new function rsyserr
[rsync/rsync.git] / exclude.c
index 6539b0f..cbf6105 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -148,7 +148,7 @@ int check_exclude(char *name, struct exclude_struct **local_exclude_list,
                  STRUCT_STAT *st)
 {
        int n;
-        struct exclude_struct const *ent;
+        struct exclude_struct *ent;
 
        if (name && (name[0] == '.') && !name[1])
                /* never exclude '.', even if somebody does --exclude '*' */
@@ -220,7 +220,10 @@ struct exclude_struct **make_exclude_list(char *fname,
        char line[MAXPATHLEN];
        if (!f) {
                if (fatal) {
-                       rprintf(FERROR,"%s : %s\n",fname,strerror(errno));
+                       rsyserr(FERROR, errno,
+                                "failed to open %s file %s",
+                                include ? "include" : "exclude",
+                                fname);
                        exit_cleanup(RERR_FILEIO);
                }
                return list;