File: 64-pg_upgrade-sockdir

package info (click to toggle)
postgresql-9.6 9.6.17-0%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 129,840 kB
  • sloc: ansic: 743,530; sql: 67,512; xml: 30,901; yacc: 30,445; perl: 16,302; lex: 7,822; sh: 5,290; makefile: 4,780; python: 112; asm: 65; sed: 15
file content (18 lines) | stat: -rw-r--r-- 775 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Fix for: connection to database failed: Unix-domain socket path "/build/buildd-postgresql-9.3_9.3~beta1-1-i386-mHjRUH/postgresql-9.3-9.3~beta1/build/contrib/pg_upgrade/.s.PGSQL.50432" is too long (maximum 107 bytes)

See also: http://lists.debian.org/debian-wb-team/2013/05/msg00015.html

--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -460,6 +460,11 @@ get_sock_dir(ClusterInfo *cluster, bool
 			cluster->sockdir = pg_malloc(MAXPGPATH);
 			if (!getcwd(cluster->sockdir, MAXPGPATH))
 				pg_fatal("cannot find current directory\n");
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX 108
+#endif
+			if (strlen(cluster->sockdir) >= UNIX_PATH_MAX - sizeof(".s.PGSQL.50432"))
+				strcpy(cluster->sockdir, "/tmp"); /* fall back to tmp */
 		}
 		else
 		{