diff options
| author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-09-14 13:43:58 -0400 | 
|---|---|---|
| committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-11-01 13:31:13 +0000 | 
| commit | 5424c63fe146e42cfc9be45b0b9830bcc948b7aa (patch) | |
| tree | 1f3e1091eb26ac056ff21422e201ae8b998e6c3f | |
| parent | 4a53ed72478c3ce788e295223d45cb578949241e (diff) | |
xlator/tier: flood of -Wformat-truncation warnings with gcc-7.1v4.0dev1
Starting in Fedora 26 which has gcc-7.1.x, -Wformat-trunction is enabled
with -Wformat, resulting in a flood of new warnings. This many warnings
is a concern because it makes it hard(er) to see other warnings that
should be addressed.
An example is at
https://kojipkgs.fedoraproject.org//packages/glusterfs/3.12.0/1.fc28/data/logs/x86_64/build.log
For more info see https://review.gluster.org/#/c/18267/
Change-Id: Id7ef8e0dedd28ada55f72c03d91facbe1c9888bd
BUG: 1492849
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
| -rw-r--r-- | xlators/cluster/dht/src/tier.c | 17 | 
1 files changed, 9 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index db23b9661bb..6223b773cf7 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -1687,11 +1687,10 @@ tier_migrate_files_using_qfile (migration_args_t *comp,          int ret                                 = -1;          tier_brick_list_t *local_brick          = NULL;          tier_brick_list_t *temp                 = NULL; -        char query_file_path_err[PATH_MAX]      = ""; -        struct tm tm                            = {0}; -        gfdb_time_t current_time                = {0}; -        char time_str[256]                      = {0}; -        char time_format[20]                    = "%Y-%m-%d-%H-%M-%S"; +        char query_file_path_err[PATH_MAX+128]  = {0,}; +        struct tm tm                            = {0,}; +        gfdb_time_t current_time                = {0,}; +        char time_str[128]                      = {0,};          ssize_t qfile_array_size                = 0;          int count                               = 0;          int temp_fd                             = 0; @@ -1702,7 +1701,7 @@ tier_migrate_files_using_qfile (migration_args_t *comp,          /* Time format for error query files */          gettimeofday (¤t_time, NULL);          gmtime_r (¤t_time.tv_sec, &tm); -        strftime (time_str, 256, time_format, &tm); +        strftime (time_str, sizeof (time_str), "%F-%T", &tm);          /* Build the qfile list */          list_for_each_entry_safe (local_brick, temp, comp->brick_list, list) { @@ -1760,8 +1759,10 @@ out:                  list_for_each_entry_safe (local_brick, temp, comp->brick_list,                                          list) {                          /* rename error qfile*/ -                        snprintf (query_file_path_err, PATH_MAX, "%s-%s.err", -                                local_brick->qfile_path, time_str); +                        snprintf (query_file_path_err, +                                  sizeof (query_file_path_err), +                                  "%s-%s.err", local_brick->qfile_path, +                                  time_str);                          sys_rename (local_brick->qfile_path,                                  query_file_path_err);                  }  | 
