Sorted linked-list in C (self-compiling)
All in all there's not much to criticize. Be sure to fix the bugs mentioned in the other answer, though!



Fail fast

struct node *new = malloc(sizeof(struct node));
new-&gt;priority = priority;


You do not check whether allocation succeeded.  Thus the next line will probably result in a crash in case malloc returned NULL.  But it could also continue to seem to be working, failing at a potentially completely unrelated point in your program.  That's the problem with undefined behavior. Thus, if you want an allocation failure to be a fatal failure, then you have to actually code such a failure mode:

void * malloc_or_die(size_t size) {
  void * pointer = malloc(size);
  if (pointer) {
    return pointer;
  }
  fprintf(stderr, "Fatal: failed to allocate memory of size %zu.\n", size);
  exit(EXIT_FAILURE);
}


The trick


  Also, what do you think of my self-compiling trick?


//usr/bin/gcc ${0##*/} -o temp &amp;&amp; ./temp ; rm temp 2&gt;/dev/null ; exit



Path to compiler hard coded
Compiler hard coded
Deletes a possibly existing file temp without asking


It's a "trick" that's fun to show once, but really don't use it.  If you want to avoid the sequence of commands to compile, run and possibly delete, then write a shell function to do that for you.

Global variable

struct node *head;


You could make your code more general (as in usable for more than one single list instance) if you pass (a pointer to) such a head pointer in to your functions.

Use blocks

    if(curr-&gt;next)
        curr-&gt;next-&gt;prev = curr-&gt;prev;


Just always use { /* ... */ }.  Saves you from potential headaches when you later add a line of code without looking too closely.

Consistency

Just some small oddities, nothing of real importance:


You have struct node *next; but also char** argv.  Decide whether you want to keep the * next to the type or the declared name.
You test for (curr != NULL) but also use !curr in a condition later one.  Use either curr != NULL and curr == NULL or curr and !curr.