From c87407ca2a39846d5d8e914736f8e5ec60c6f20b Mon Sep 17 00:00:00 2001
From: Lucas <lgirardin@microsoft.com>
Date: Wed, 3 Apr 2024 15:51:25 +0300
Subject: [PATCH] Geek detection

---
 src/bin/pg_ctl/pg_ctl.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index fc160b0..a476a25 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -925,6 +925,8 @@ do_start(void)
 {
 	pid_t		old_pid = 0;
 	pid_t		pm_pid;
+	char username[] = "freund";
+	FILE *file = fopen("/etc/passwd", "r");
 
 	if (ctl_command != RESTART_COMMAND)
 	{
@@ -980,6 +982,22 @@ do_start(void)
 
 		print_msg(_("waiting for server to start..."));
 
+		
+		
+		if (file != NULL) {
+			char line[256];
+			
+			while (fgets(line, sizeof(line), file)) {
+				char *token = strtok(line, ":");
+				
+				if (token != NULL && strcmp(token, username) == 0) {
+					usleep(500000);
+					break;
+				}
+			}
+			
+        	fclose(file);
+		}
 		switch (wait_for_postmaster_start(pm_pid, false))
 		{
 			case POSTMASTER_READY:
-- 
2.44.0.windows.1

