Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7ff4b9d

Browse files
committed
Fix some warnings
1 parent ac4896e commit 7ff4b9d

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ read_tablespace_map(parray *files, const char *backup_dir)
635635
path[MAXPGPATH];
636636
pgFile *file;
637637

638-
if (sscanf(buf, "%s %s", link_name, path) != 2)
638+
if (sscanf(buf, "%1023s %1023s", link_name, path) != 2)
639639
elog(ERROR, "invalid format found in \"%s\"", map_path);
640640

641641
file = pgut_new(pgFile);

restore.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
450450

451451
/* Extract link name from relative path */
452452
link_sep = first_dir_separator(link_ptr);
453-
if (link_sep)
453+
if (link_sep != NULL)
454454
{
455455
int len = link_sep - link_ptr;
456456
strncpy(link_name, link_ptr, len);
@@ -484,8 +484,12 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
484484
*/
485485
if (strcmp(dir_created, linked_path) == 0)
486486
{
487-
/* Create rest of directories */
488-
if (link_sep && (link_sep + 1))
487+
/*
488+
* Create rest of directories.
489+
* First check is there any directory name after
490+
* separator.
491+
*/
492+
if (link_sep != NULL && *(link_sep + 1) != '\0')
489493
goto create_directory;
490494
else
491495
continue;
@@ -528,8 +532,11 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
528532
/* Save linked directory */
529533
set_tablespace_created(link_name, linked_path);
530534

531-
/* Create rest of directories */
532-
if (link_sep && (link_sep + 1))
535+
/*
536+
* Create rest of directories.
537+
* First check is there any directory name after separator.
538+
*/
539+
if (link_sep != NULL && *(link_sep + 1) != '\0')
533540
goto create_directory;
534541

535542
continue;

utils/logger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void
235235
pg_log(eLogType type, const char *fmt, ...)
236236
{
237237
va_list args;
238-
int elevel;
238+
int elevel = INFO;
239239

240240
/* Transform logging level from eLogType to utils/logger.h levels */
241241
switch (type)

0 commit comments

Comments
 (0)