]> andersk Git - splint.git/blobdiff - src/osd.c
Surpressed spurious splintme error in osd.c
[splint.git] / src / osd.c
index 3d75cf64ea2ba65085664ac4049da2373be931b3..71b5de41f10f4f0978283258913a93d7b2e164eb 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -868,6 +868,7 @@ static void osd_setWorkingDirectory (void)
     {
       lldiagmsg (message ("Cannot get working directory: %s\n",
                          lldecodeerror (errno)));
+      osd_cwd = cstring_makeLiteral ("<missing directory>");
     }
   else
     {
@@ -903,7 +904,7 @@ cstring osd_absolutePath (cstring cwd, cstring filename)
   llassert (cstring_isDefined (cwd2));
   llassert (cstring_isDefined (filename));
 
-  abs_buffer = (char *) dmalloc (size_fromInt (cstring_length (cwd2) + cstring_length (filename) + 2));
+  abs_buffer = (char *) dmalloc (cstring_length (cwd2) + cstring_length (filename) + 2);
   endp = abs_buffer;
   
   /*
@@ -1053,6 +1054,12 @@ cstring osd_outputPath (cstring filename)
   rel_buf_p = rel_buffer;
   *rel_buf_p = '\0';
 
+  if (cwd_p == NULL) 
+    {
+      /* Need to prevent recursive assertion failures */
+      return cstring_copy (filename);
+    }
+
   llassert (cwd_p != NULL);
   llassert (path_p != NULL);
 
@@ -1126,7 +1133,16 @@ cstring osd_outputPath (cstring filename)
         {
           /* Give up if the result gets to be longer
              than the absolute path name.  */
-          if (rel_buffer + filename_len <= rel_buf_p + 3)
+         char * temp_rel_buf_p;
+
+         /*drl This comment is necessary because for some reason Splint
+           does not realize that the pasts where rel_buf_p is released
+           do not reach here*/
+         /*@-usereleased@*/
+         temp_rel_buf_p = rel_buf_p;
+         /*@-usereleased@*/
+         
+          if (rel_buffer + filename_len <= temp_rel_buf_p + 3)
            {
              sfree (rel_buffer);
              return cstring_copy (filename);
This page took 0.087728 seconds and 4 git commands to generate.