]> granicus.if.org Git - postgresql/commitdiff
Fix compiler warning.
authorRobert Haas <rhaas@postgresql.org>
Wed, 18 Dec 2013 18:31:35 +0000 (13:31 -0500)
committerRobert Haas <rhaas@postgresql.org>
Wed, 18 Dec 2013 18:31:35 +0000 (13:31 -0500)
get_user_name returns const char *, but we were assigning the result
to a char * variable.

contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/util.c

index d25ac37a15104e2b240f3595f68da38cae3b316a..938bb870b4d5771be2e25e6d6571579375d2daf4 100644 (file)
@@ -443,7 +443,7 @@ void                check_pghost_envvar(void);
 /* util.c */
 
 char      *quote_identifier(const char *s);
-int                    get_user_info(char **user_name);
+int                    get_user_info(char **user_name_p);
 void           check_ok(void);
 void
 report_status(eLogType type, const char *fmt,...)
index c3d45237fde6337c7f0eae4b7f45478489a3c0d3..a7a48d782b5da86ffb641f46f712d80bfb1d7a65 100644 (file)
@@ -205,9 +205,10 @@ quote_identifier(const char *s)
  * get_user_info()
  */
 int
-get_user_info(char **user_name)
+get_user_info(char **user_name_p)
 {
        int                     user_id;
+       const char *user_name;
        char       *errstr;
 
 #ifndef WIN32
@@ -216,12 +217,12 @@ get_user_info(char **user_name)
        user_id = 1;
 #endif
 
-       *user_name = get_user_name(&errstr);
-       if (!*user_name)
+       user_name = get_user_name(&errstr);
+       if (!user_name)
                pg_fatal("%s\n", errstr);
 
        /* make a copy */
-       *user_name = pg_strdup(*user_name);
+       *user_name_p = pg_strdup(user_name);
 
        return user_id;
 }