Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d9b092

Browse files
committed
Better error reporting if the link target is too long
This situation won't set errno, so using %m will give an incorrecterror message.
1 parent1f422db commit0d9b092

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/utils/adt/misc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,12 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
287287
*/
288288
snprintf(sourcepath,sizeof(sourcepath),"pg_tblspc/%u",tablespaceOid);
289289
rllen=readlink(sourcepath,targetpath,sizeof(targetpath));
290-
if (rllen<0||rllen >=sizeof(targetpath))
290+
if (rllen<0)
291291
ereport(ERROR,
292292
(errmsg("could not read symbolic link \"%s\": %m",sourcepath)));
293+
elseif (rllen >=sizeof(targetpath))
294+
ereport(ERROR,
295+
(errmsg("symbolic link \"%s\" target is too long",sourcepath)));
293296
targetpath[rllen]='\0';
294297

295298
PG_RETURN_TEXT_P(cstring_to_text(targetpath));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp