Skip to content

Commit dec9184

Browse files
committed
I guess I'd vote for changing the code to be
sys = malloc(strlen(editorName) + strlen(fname) + 10 + 1); if (!sys) return false; sprintf(sys, "exec '%s' '%s'", editorName, fname); (note the added quotes to provide a little protection against spaces and such). Then it's perfectly obvious what the calculation is doing. I don't care about wasting 20-some bytes, but confusing readers of the code is worth avoiding. regards, tom lane
1 parent 538b101 commit dec9184

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

doc/TODO

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TODO list for PostgreSQL
22
========================
3-
Last updated: Wed Aug 14 00:57:54 EDT 2002
3+
Last updated: Wed Aug 14 01:46:11 EDT 2002
44

55
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
66

@@ -205,7 +205,8 @@ Commands
205205
o Add ALTER TABLE tab SET WITHOUT OIDS
206206

207207
* CLUSTER
208-
o Cluster all tables at once
208+
o Cluster all tables at once using pg_index.indisclustered or primary
209+
key
209210
o Prevent loss of indexes, permissions, inheritance
210211
o Automatically maintain clustering on a table
211212

src/bin/psql/command.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000-2002 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.77 2002/08/13 21:04:36 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.78 2002/08/14 05:49:22 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -1510,10 +1510,10 @@ editFile(const char *fname)
15101510
if (!editorName)
15111511
editorName = DEFAULT_EDITOR;
15121512

1513-
sys = malloc(strlen(editorName) + strlen(fname) + 32 + 1);
1513+
sys = malloc(strlen(editorName) + strlen(fname) + 10 + 1);
15141514
if (!sys)
15151515
return false;
1516-
sprintf(sys, "exec %s %s", editorName, fname);
1516+
sprintf(sys, "exec '%s' '%s'", editorName, fname);
15171517
result = system(sys);
15181518
if (result == -1)
15191519
psql_error("could not start editor %s\n", editorName);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy