Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 25bb718

Browse files
committed
Fix: Can't drop tables with names longer than 16 characters.
1 parent d31084e commit 25bb718

File tree

1 file changed

+5
-5
lines changed
  • src/backend/storage/smgr

1 file changed

+5
-5
lines changed

src/backend/storage/smgr/md.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.1.1.1 1996/07/09 06:21:59 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.2 1996/07/09 06:35:38 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -146,8 +146,8 @@ mdunlink(Relation reln)
146146
int i;
147147
MdfdVec *v, *ov;
148148
MemoryContext oldcxt;
149-
char fname[20]; /* XXX should have NAMESIZE defined */
150-
char tname[20];
149+
char fname[NAMEDATALEN];
150+
char tname[NAMEDATALEN+10]; /* leave room for overflow suffixes*/
151151

152152
/* On Windows NT you can't unlink a file if it is open so we have
153153
** to do this.
@@ -157,8 +157,8 @@ mdunlink(Relation reln)
157157
#endif /* WIN32 */
158158

159159

160-
memset(fname,0,20);
161-
strncpy(fname, RelationGetRelationName(reln)->data, 16);
160+
memset(fname,0, NAMEDATALEN);
161+
strncpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
162162

163163
if (FileNameUnlink(fname) < 0)
164164
return (SM_FAIL);

0 commit comments

Comments
 (0)