(tempname): AND-off high bits of pid so that its decimal
authorJim Meyering <jim@meyering.net>
Wed, 26 Apr 1995 16:12:01 +0000 (16:12 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 26 Apr 1995 16:12:01 +0000 (16:12 +0000)
string representation is no longer than five digits.
From Hans Verkuil (hans@wyst.hobby.nl)

src/sort.c

index 3c0b3a5..d45b664 100644 (file)
@@ -315,7 +315,7 @@ tempname ()
           (len && temp_file_prefix[len - 1] != '/'
            ? "%s/sort%5.5d%5.5d"
            : "%ssort%5.5d%5.5d"),
-          temp_file_prefix, (int) getpid (), ++seq);
+          temp_file_prefix, (unsigned int) getpid () & 0xffff, ++seq);
   node->name = name;
   node->next = temphead.next;
   temphead.next = node;