diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index dc7e19c61add3a48a90c976eba84dddb043c0202..aacb588feb63010fec560d2dec328f631f21af19 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -402,7 +402,7 @@ func attach(ctx *cli.Context) {
 		client, err = comms.ClientFromEndpoint(ctx.Args().First(), codec.JSON)
 	} else {
 		cfg := comms.IpcConfig{
-			Endpoint: ctx.GlobalString(utils.IPCPathFlag.Name),
+			Endpoint: utils.IpcSocketPath(ctx),
 		}
 		client, err = comms.NewIpcClient(cfg, codec.JSON)
 	}