bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mktemp, sort, tac: don't use undefined after mkstemp failure


From: Jim Meyering
Subject: Re: [PATCH] mktemp, sort, tac: don't use undefined after mkstemp failure
Date: Wed, 13 Aug 2008 20:50:45 +0200

Andreas Schwab <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>> diff --git a/src/sort.c b/src/sort.c
>> index b932a51..728c935 100644
>> --- a/src/sort.c
>> +++ b/src/sort.c
>> @@ -741,7 +741,7 @@ create_temp_file (int *pfd)
>>    errno = saved_errno;
>>
>>    if (fd < 0)
>> -    die (_("cannot create temporary file"), file);
>> +    die (_("cannot create temporary file in"), temp_dir);
>
> The actual error message is constructed by putting a colon between the
> string and the file argument.  Since the string does not represent a
> complete sentence this is not i18n friendly.

True.  Thanks.
I'm adjusting it with this incremental change:

diff --git a/src/sort.c b/src/sort.c
index 728c935..43a92f9 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -741,7 +741,11 @@ create_temp_file (int *pfd)
   errno = saved_errno;

   if (fd < 0)
-    die (_("cannot create temporary file in"), temp_dir);
+    {
+      error (0, errno, _("cannot create temporary file in %s"),
+            quote (temp_dir));
+      exit (SORT_FAILURE);
+    }

   *pfd = fd;
   return node;
diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge
index 53559bf..6b81926 100755
--- a/tests/misc/sort-merge
+++ b/tests/misc/sort-merge
@@ -66,8 +66,9 @@ my @Tests =
      # this should fail since nmerge < # of input files, so
      # temp files are needed
      ['nmerge-no', "-m --batch-size=2 -T$badtmp", @inputs,
-        {ERR_SUBST=>"s|(: $badtmp):.*|\$1|"},
-        {ERR=>"$prog: cannot create temporary file in: $badtmp\n"}, {EXIT=>2}],
+        {ERR_SUBST=>"s|': .*|':|"},
+        {ERR=>"$prog: cannot create temporary file in `$badtmp':\n"},
+       {EXIT=>2}],

      # This used to fail because setting batch-size without also setting
      # buffer size would cause the buffer size to be set to the minimum.
--
1.6.0.rc2.38.g413e06




reply via email to

[Prev in Thread] Current Thread [Next in Thread]